comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java @ 13535:e8ef44830b50

Truffle-DSL: fixed bugs due to previous cleanup. addtional cleanup.
author Christian Humer <christian.humer@gmail.com>
date Tue, 07 Jan 2014 22:06:37 +0100
parents b466199f19e1
children 419b3ea1bdd1
comparison
equal deleted inserted replaced
13534:dbc17f07cec6 13535:e8ef44830b50
962 CodeTreeBuilder nullBuilder = builder.create(); 962 CodeTreeBuilder nullBuilder = builder.create();
963 CodeTreeBuilder oldBuilder = builder.create(); 963 CodeTreeBuilder oldBuilder = builder.create();
964 CodeTreeBuilder resetBuilder = builder.create(); 964 CodeTreeBuilder resetBuilder = builder.create();
965 965
966 for (ActualParameter param : getModel().getSignatureParameters()) { 966 for (ActualParameter param : getModel().getSignatureParameters()) {
967 NodeChildData child = param.getSpecification().getExecution().getChild(); 967 NodeExecutionData execution = param.getSpecification().getExecution();
968 968
969 CodeTreeBuilder access = builder.create(); 969 CodeTreeBuilder access = builder.create();
970 access.string("this.").string(child.getName()); 970 access.string("this.").string(execution.getChild().getName());
971 if (child.getCardinality().isMany()) { 971 if (execution.isIndexed()) {
972 access.string("[").string(String.valueOf(param.getSpecificationVarArgsIndex())).string("]"); 972 access.string("[").string(String.valueOf(execution.getIndex())).string("]");
973 } 973 }
974 974
975 String oldName = "old" + Utils.firstLetterUpperCase(param.getLocalName()); 975 String oldName = "old" + Utils.firstLetterUpperCase(param.getLocalName());
976 oldBuilder.declaration(child.getNodeData().getNodeType(), oldName, access); 976 oldBuilder.declaration(execution.getChild().getNodeData().getNodeType(), oldName, access);
977 nullBuilder.startStatement().tree(access.getRoot()).string(" = null").end(); 977 nullBuilder.startStatement().tree(access.getRoot()).string(" = null").end();
978 resetBuilder.startStatement().tree(access.getRoot()).string(" = ").string(oldName).end(); 978 resetBuilder.startStatement().tree(access.getRoot()).string(" = ").string(oldName).end();
979 } 979 }
980 980
981 builder.tree(oldBuilder.getRoot()); 981 builder.tree(oldBuilder.getRoot());
1109 CodeExecutableElement cachedExecute = new CodeExecutableElement(modifiers(PROTECTED, ABSTRACT), polymorph.getReturnType().getType(), EXECUTE_POLYMORPHIC_NAME); 1109 CodeExecutableElement cachedExecute = new CodeExecutableElement(modifiers(PROTECTED, ABSTRACT), polymorph.getReturnType().getType(), EXECUTE_POLYMORPHIC_NAME);
1110 addInternalValueParameters(cachedExecute, polymorph, true, false); 1110 addInternalValueParameters(cachedExecute, polymorph, true, false);
1111 1111
1112 ExecutableTypeData sourceExecutableType = node.findExecutableType(polymorph.getReturnType().getTypeSystemType(), 0); 1112 ExecutableTypeData sourceExecutableType = node.findExecutableType(polymorph.getReturnType().getTypeSystemType(), 0);
1113 boolean sourceThrowsUnexpected = sourceExecutableType != null && sourceExecutableType.hasUnexpectedValue(getContext()); 1113 boolean sourceThrowsUnexpected = sourceExecutableType != null && sourceExecutableType.hasUnexpectedValue(getContext());
1114 if (sourceExecutableType.getType().equals(node.getGenericSpecialization().getReturnType().getTypeSystemType())) { 1114 if (sourceThrowsUnexpected && sourceExecutableType.getType().equals(node.getGenericSpecialization().getReturnType().getTypeSystemType())) {
1115 sourceThrowsUnexpected = false; 1115 sourceThrowsUnexpected = false;
1116 } 1116 }
1117 if (sourceThrowsUnexpected) { 1117 if (sourceThrowsUnexpected) {
1118 cachedExecute.getThrownTypes().add(getContext().getType(UnexpectedResultException.class)); 1118 cachedExecute.getThrownTypes().add(getContext().getType(UnexpectedResultException.class));
1119 } 1119 }