use of com.oracle.truffle.dsl.processor.expression.DSLExpression.Variable in project graal by oracle.
the class FlatNodeGenFactory method castBoundTypes.
private static Map<Variable, CodeTree> castBoundTypes(Map<Variable, LocalVariable> bindings) {
Map<Variable, CodeTree> resolvedBindings = new HashMap<>();
for (Variable variable : bindings.keySet()) {
LocalVariable localVariable = bindings.get(variable);
CodeTree resolved = localVariable.createReference();
TypeMirror sourceType = localVariable.getTypeMirror();
TypeMirror targetType = variable.getResolvedTargetType();
if (targetType == null) {
targetType = variable.getResolvedType();
}
if (!ElementUtils.isAssignable(sourceType, targetType)) {
resolved = CodeTreeBuilder.createBuilder().startParantheses().cast(targetType, resolved).end().build();
}
resolvedBindings.put(variable, resolved);
}
return resolvedBindings;
}
Aggregations