diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeData.java @ 11439:efe58aa92f86

Truffle-DSL: guards can now be declared using any base type or interface of the target value type.
author Christian Humer <christian.humer@gmail.com>
date Tue, 27 Aug 2013 22:08:26 +0200
parents e93efe3ba5f4
children bd28da642eea
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeData.java	Tue Aug 27 18:11:35 2013 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeData.java	Tue Aug 27 22:08:26 2013 +0200
@@ -120,16 +120,7 @@
     }
 
     public boolean needsCastTo(ProcessorContext context, TypeData targetType) {
-        if (this.equals(targetType)) {
-            return false;
-        } else if (targetType.isGeneric()) {
-            return false;
-        } else if (targetType.isVoid()) {
-            return false;
-        } else if (Utils.isAssignable(context, getPrimitiveType(), targetType.getPrimitiveType())) {
-            return false;
-        }
-        return true;
+        return Utils.needsCastTo(context, getPrimitiveType(), targetType.getPrimitiveType());
     }
 
     public boolean isPrimitive() {