comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/ElementUtils.java @ 20952:833e088ee7d3

Truffle-DSL: fixed invalid execute delegation
author Christian Humer <christian.humer@gmail.com>
date Tue, 14 Apr 2015 19:41:36 +0200
parents 810d466073f0
children 05a2b72c071f
comparison
equal deleted inserted replaced
20951:a77b760a0307 20952:833e088ee7d3
145 result.add(explicit); 145 result.add(explicit);
146 } 146 }
147 return result; 147 return result;
148 } 148 }
149 149
150 public static TypeMirror getCommonSuperType(ProcessorContext context, TypeMirror[] types) { 150 public static TypeMirror getCommonSuperType(ProcessorContext context, Collection<TypeMirror> types) {
151 if (types.length == 0) { 151 if (types.isEmpty()) {
152 return context.getType(Object.class); 152 return context.getType(Object.class);
153 } 153 }
154 TypeMirror prev = types[0]; 154 Iterator<TypeMirror> typesIterator = types.iterator();
155 for (int i = 1; i < types.length; i++) { 155 TypeMirror prev = typesIterator.next();
156 prev = getCommonSuperType(context, prev, types[i]); 156 while (typesIterator.hasNext()) {
157 prev = getCommonSuperType(context, prev, typesIterator.next());
157 } 158 }
158 return prev; 159 return prev;
159 } 160 }
160 161
161 private static TypeMirror getCommonSuperType(ProcessorContext context, TypeMirror type1, TypeMirror type2) { 162 private static TypeMirror getCommonSuperType(ProcessorContext context, TypeMirror type1, TypeMirror type2) {