comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeMethodParser.java @ 13532:85b485b1e8e1

Truffle-DSL: removed support for implicit parameters. not needed anymore.
author Christian Humer <christian.humer@gmail.com>
date Tue, 07 Jan 2014 20:06:27 +0100
parents 5a0c694ef735
children e8ef44830b50
comparison
equal deleted inserted replaced
13531:1f870eaf1e96 13532:85b485b1e8e1
74 @SuppressWarnings("unused") 74 @SuppressWarnings("unused")
75 protected final MethodSpec createDefaultMethodSpec(ExecutableElement method, AnnotationMirror mirror, boolean shortCircuitsEnabled, String shortCircuitName) { 75 protected final MethodSpec createDefaultMethodSpec(ExecutableElement method, AnnotationMirror mirror, boolean shortCircuitsEnabled, String shortCircuitName) {
76 MethodSpec methodSpec = new MethodSpec(createReturnParameterSpec()); 76 MethodSpec methodSpec = new MethodSpec(createReturnParameterSpec());
77 77
78 addDefaultFrame(methodSpec); 78 addDefaultFrame(methodSpec);
79 addDefaultImplicitThis(method, methodSpec);
80 addDefaultFieldMethodSpec(methodSpec); 79 addDefaultFieldMethodSpec(methodSpec);
81 addDefaultChildren(shortCircuitsEnabled, shortCircuitName, methodSpec); 80 addDefaultChildren(shortCircuitsEnabled, shortCircuitName, methodSpec);
82 81
83 return methodSpec; 82 return methodSpec;
84 } 83 }
115 methodSpec.addOptional(spec); 114 methodSpec.addOptional(spec);
116 } 115 }
117 } 116 }
118 } 117 }
119 118
120 protected void addDefaultImplicitThis(ExecutableElement method, MethodSpec methodSpec) {
121 if (method == null) {
122 return;
123 }
124 TypeMirror declaredType = Utils.findNearestEnclosingType(method).asType();
125
126 if (!method.getModifiers().contains(Modifier.STATIC) && !Utils.isAssignable(getContext(), declaredType, getContext().getTruffleTypes().getNode())) {
127 methodSpec.addImplicitRequiredType(getNode().getTemplateType().asType());
128 }
129 }
130
131 private static String shortCircuitValueName(String valueName) { 119 private static String shortCircuitValueName(String valueName) {
132 return "has" + Utils.firstLetterUpperCase(valueName); 120 return "has" + Utils.firstLetterUpperCase(valueName);
133 } 121 }
134 122
135 } 123 }