소스 검색

Handling type cast to enumerator type.

Thomas Kutz 10 년 전
부모
커밋
8602878e27

+ 5 - 0
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend

@@ -119,6 +119,11 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 		throw new IllegalArgumentException
 	}
 
+	def dispatch Object typeCast(Enumerator value, Type type) {
+		if(ts.isSuperType(type, value.owningEnumeration)) return value
+		throw new IllegalArgumentException
+	}
+
 	def dispatch Object typeCast(Object value, Type type) {
 		throw new IllegalArgumentException("Invalid cast " + value.class + " to " + type.name)
 	}