comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/TypeCastParser.java @ 18758:3912400fc33a

Truffle-DSL: remove type system singleton
author Christian Humer <christian.humer@gmail.com>
date Mon, 29 Dec 2014 23:38:42 +0100
parents 0370880ac9ce
children 3ea386a1036f
comparison
equal deleted inserted replaced
18757:0ec5f5a2e720 18758:3912400fc33a
61 if (parameter != null) { 61 if (parameter != null) {
62 sourceType = getTypeSystem().findTypeData(parameter.getType()); 62 sourceType = getTypeSystem().findTypeData(parameter.getType());
63 } 63 }
64 TypeCastData cast = new TypeCastData(method, sourceType, targetType); 64 TypeCastData cast = new TypeCastData(method, sourceType, targetType);
65 65
66 if (!method.getMethod().getModifiers().contains(Modifier.STATIC)) {
67 cast.addError("@%s annotated method %s must be static.", TypeCast.class.getSimpleName(), method.getMethodName());
68 }
69
66 if (targetType != method.getReturnType().getTypeSystemType()) { 70 if (targetType != method.getReturnType().getTypeSystemType()) {
67 cast.addError("Cast type %s does not match to the returned type %s.", ElementUtils.getSimpleName(targetType.getPrimitiveType()), 71 cast.addError("Cast type %s does not match to the returned type %s.", ElementUtils.getSimpleName(targetType.getPrimitiveType()),
68 method.getReturnType() != null ? ElementUtils.getSimpleName(method.getReturnType().getTypeSystemType().getPrimitiveType()) : null); 72 method.getReturnType() != null ? ElementUtils.getSimpleName(method.getReturnType().getTypeSystemType().getPrimitiveType()) : null);
69 } 73 }
70 return cast; 74 return cast;