MCPcopy Create free account
hub / github.com/dynjs/dynjs / AbstractStatement

Class AbstractStatement

src/main/java/org/dynjs/parser/ast/AbstractStatement.java:35–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33import me.qmx.jitescript.internal.org.objectweb.asm.tree.LabelNode;
34
35public abstract class AbstractStatement implements Statement {
36
37 private final static AtomicInteger counter = new AtomicInteger();
38 private int number;
39 private List<String> labels = new ArrayList<String>();
40
41 AbstractStatement() {
42 this.number = counter.incrementAndGet();
43 }
44
45 public int getStatementNumber() {
46 return this.number;
47 }
48
49 public void addLabel(String label) {
50 this.labels.add(label);
51 }
52
53 public List<String> getLabels() {
54 return this.labels;
55 }
56
57 public List<FunctionDeclaration> getFunctionDeclarations() {
58 return Collections.emptyList();
59 }
60
61 public List<VariableDeclaration> getVariableDeclarations() {
62 return Collections.emptyList();
63 }
64
65 public CodeBlock normalCompletion() {
66 return new CodeBlock()
67 .invokestatic(p(Completion.class), "createNormal", sig(Completion.class));
68 }
69
70 public CodeBlock normalCompletionWithValue() {
71 return new CodeBlock()
72 // IN: val
73 .invokestatic(p(Completion.class), "createNormal", sig(Completion.class, Object.class));
74 }
75
76 public CodeBlock returnCompletion() {
77 return new CodeBlock()
78 // IN value
79 .invokestatic(p(Completion.class), "createReturn", sig(Completion.class, Object.class));
80 // completion
81 }
82
83 public CodeBlock continueCompletion(final String target) {
84 CodeBlock codeBlock = new CodeBlock();
85 // <EMPTY>
86 if (target == null) {
87 codeBlock.aconst_null();
88 } else {
89 codeBlock.ldc(target);
90 }
91 // target
92 codeBlock.invokestatic(p(Completion.class), "createContinue", sig(Completion.class, String.class));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected