comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/model/CodeTreeBuilder.java @ 20940:476374f3fe9a

Truffle-DSL: generate better polymorphic execute signatures
author Christian Humer <christian.humer@gmail.com>
date Tue, 14 Apr 2015 15:12:48 +0200
parents 08aa0372dad4
children
comparison
equal deleted inserted replaced
20939:f83fd99b2962 20940:476374f3fe9a
312 } else { 312 } else {
313 BuilderCodeTree tree = new BuilderCodeTree(currentElement, GROUP, null, null); 313 BuilderCodeTree tree = new BuilderCodeTree(currentElement, GROUP, null, null);
314 currentElement.add(treeToAdd); 314 currentElement.add(treeToAdd);
315 return push(tree, true).end(); 315 return push(tree, true).end();
316 } 316 }
317 }
318
319 public CodeTreeBuilder trees(CodeTree... trees) {
320 for (CodeTree tree : trees) {
321 tree(tree);
322 }
323 return this;
317 } 324 }
318 325
319 public CodeTreeBuilder string(String chunk1, String chunk2, String chunk3, String chunk4, String... chunks) { 326 public CodeTreeBuilder string(String chunk1, String chunk2, String chunk3, String chunk4, String... chunks) {
320 push(GROUP).string(chunk1).string(chunk2).string(chunk3).string(chunk4); 327 push(GROUP).string(chunk1).string(chunk2).string(chunk3).string(chunk4);
321 for (int i = 0; i < chunks.length; i++) { 328 for (int i = 0; i < chunks.length; i++) {
859 b.append(" "); 866 b.append(" ");
860 } 867 }
861 } 868 }
862 } 869 }
863 870
871 public CodeTreeBuilder returnDefault() {
872 ExecutableElement method = findMethod();
873 if (ElementUtils.isVoid(method.getReturnType())) {
874 returnStatement();
875 } else {
876 startReturn().defaultValue(method.getReturnType()).end();
877 }
878 return this;
879
880 }
881
864 } 882 }