comparison 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
comparison
equal deleted inserted replaced
11438:b77721210bd6 11439:efe58aa92f86
118 public boolean equalsType(TypeData actualTypeData) { 118 public boolean equalsType(TypeData actualTypeData) {
119 return Utils.typeEquals(boxedType, actualTypeData.boxedType); 119 return Utils.typeEquals(boxedType, actualTypeData.boxedType);
120 } 120 }
121 121
122 public boolean needsCastTo(ProcessorContext context, TypeData targetType) { 122 public boolean needsCastTo(ProcessorContext context, TypeData targetType) {
123 if (this.equals(targetType)) { 123 return Utils.needsCastTo(context, getPrimitiveType(), targetType.getPrimitiveType());
124 return false;
125 } else if (targetType.isGeneric()) {
126 return false;
127 } else if (targetType.isVoid()) {
128 return false;
129 } else if (Utils.isAssignable(context, getPrimitiveType(), targetType.getPrimitiveType())) {
130 return false;
131 }
132 return true;
133 } 124 }
134 125
135 public boolean isPrimitive() { 126 public boolean isPrimitive() {
136 return Utils.isPrimitive(getPrimitiveType()); 127 return Utils.isPrimitive(getPrimitiveType());
137 } 128 }