Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTreeBuilder.java @ 9217:61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 15 Apr 2013 18:50:19 +0200 |
parents | 89006c76f737 |
children | 86d981cd8e22 |
comparison
equal
deleted
inserted
replaced
9216:8b9ea2f5c36e | 9217:61ba6fc21ba4 |
---|---|
44 this.root = new BuilderCodeTree(GROUP, null, null); | 44 this.root = new BuilderCodeTree(GROUP, null, null); |
45 this.currentElement = root; | 45 this.currentElement = root; |
46 this.parent = parent; | 46 this.parent = parent; |
47 } | 47 } |
48 | 48 |
49 @Override | |
50 public String toString() { | |
51 return root.toString(); | |
52 } | |
53 | |
49 public int getTreeCount() { | 54 public int getTreeCount() { |
50 return treeCount; | 55 return treeCount; |
51 } | 56 } |
52 | 57 |
53 public boolean isEmpty() { | 58 public boolean isEmpty() { |
275 public CodeTreeBuilder string(String chunk1, String chunk2, String chunk3, String chunk4) { | 280 public CodeTreeBuilder string(String chunk1, String chunk2, String chunk3, String chunk4) { |
276 return push(GROUP).string(chunk1).string(chunk2).string(chunk3).string(chunk4).end(); | 281 return push(GROUP).string(chunk1).string(chunk2).string(chunk3).string(chunk4).end(); |
277 } | 282 } |
278 | 283 |
279 public CodeTreeBuilder tree(CodeTree treeToAdd) { | 284 public CodeTreeBuilder tree(CodeTree treeToAdd) { |
280 return push((BuilderCodeTree) treeToAdd).end(); | 285 if (treeToAdd instanceof BuilderCodeTree) { |
286 return push((BuilderCodeTree) treeToAdd).end(); | |
287 } else { | |
288 BuilderCodeTree tree = new BuilderCodeTree(GROUP, null, null); | |
289 tree.add(treeToAdd); | |
290 return push(tree).end(); | |
291 } | |
281 } | 292 } |
282 | 293 |
283 public CodeTreeBuilder string(String chunk1, String chunk2, String chunk3, String chunk4, String... chunks) { | 294 public CodeTreeBuilder string(String chunk1, String chunk2, String chunk3, String chunk4, String... chunks) { |
284 push(GROUP).string(chunk1).string(chunk2).string(chunk3).string(chunk4); | 295 push(GROUP).string(chunk1).string(chunk2).string(chunk3).string(chunk4); |
285 for (int i = 0; i < chunks.length; i++) { | 296 for (int i = 0; i < chunks.length; i++) { |