-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathrt.coffee
54 lines (44 loc) · 1008 Bytes
/
rt.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Aether = require './src/aether'
aether = new Aether
language: "java"
executionLimit: 1000,
problems: {
jshint_W040: {level: "ignore"},
aether_MissingThis: {level: "warning"}
},
yieldConditionally: true
language: 'java'
includeFlow: false
includeMetrics: false
aether.className = "One"
aether.staticCall = "main"
code = """
public class One {
public static void main(String[] arg) {
hero.charge();
hero.hesitate();
hero.hesitate();
hero.charge();
hero.hesitate();
hero.charge();
}
}
"""
aether.transpile code
console.log "A", aether.problems
thisValue =
charge: () ->
@say "attack!"
return "attack!";
hesitate: () ->
@say "uhh..."
aether._shouldYield = true
say: console.log
method = aether.createMethod thisValue
generator = method()
aether.sandboxGenerator generator
executeSomeMore = () ->
result = generator.next()
if not result.done
setTimeout executeSomeMore, 2000
executeSomeMore()