Przeglądaj źródła

* Caching types in resource
* Update context predicates depending on containing references (YAKHMI-603)

benjamin.schwertfeger@gmail.com 13 lat temu
rodzic
commit
dabb6315f5

+ 53 - 26
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/ContextPredicateProvider.java

@@ -11,11 +11,13 @@
 package org.yakindu.sct.model.stext.scoping;
 
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.ASSIGNMENT_EXPRESSION;
+import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.ASSIGNMENT_EXPRESSION__EXPRESSION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.BITWISE_AND_EXPRESSION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.BITWISE_OR_EXPRESSION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.BITWISE_XOR_EXPRESSION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.CONDITIONAL_EXPRESSION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.EVENT_RAISING_EXPRESSION;
+import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.EVENT_RAISING_EXPRESSION__VALUE;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.EVENT_VALUE_REFERENCE_EXPRESSION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.LOCAL_REACTION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.LOGICAL_AND_EXPRESSION;
@@ -35,11 +37,14 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
 import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.util.Pair;
+import org.eclipse.xtext.util.Tuples;
 import org.yakindu.base.types.TypesPackage;
 
 import com.google.common.base.Predicate;
-
+import com.google.common.base.Predicates;
 
 /**
  * @author andreas muelder - Initial contribution and API
@@ -99,42 +104,64 @@ public class ContextPredicateProvider {
 	private static final VariablePredicate VARIABLES = new VariablePredicate();
 	private static final EventPredicate EVENTS = new EventPredicate();
 	private static final VariableOperationPredicate VARIABLES_AND_OPERATIONS = new VariableOperationPredicate();
+	private static final Predicate<IEObjectDescription> ALL = Predicates
+			.<IEObjectDescription> alwaysTrue();
 
-	private final Map<EClass, Predicate<IEObjectDescription>> filter;
+	private final Map<Pair<EClass, EReference>, Predicate<IEObjectDescription>> filter;
 
 	public ContextPredicateProvider() {
-		filter = new HashMap<EClass, Predicate<IEObjectDescription>>();
+		filter = new HashMap<Pair<EClass, EReference>, Predicate<IEObjectDescription>>();
 		initMap();
 	}
 
+	private Pair<EClass, EReference> key(EClass eClass) {
+		return Tuples.create(eClass, null);
+	}
+
+	private Pair<EClass, EReference> key(EClass eClass, EReference ref) {
+		return Tuples.create(eClass, ref);
+	}
+
 	protected void initMap() {
-		filter.put(ASSIGNMENT_EXPRESSION, VARIABLES);
-		filter.put(CONDITIONAL_EXPRESSION, VARIABLES_AND_OPERATIONS);
-		filter.put(LOGICAL_OR_EXPRESSION, VARIABLES_AND_OPERATIONS);
-		filter.put(LOGICAL_AND_EXPRESSION, VARIABLES_AND_OPERATIONS);
-		filter.put(LOGICAL_NOT_EXPRESSION, VARIABLES_AND_OPERATIONS);
-		filter.put(BITWISE_XOR_EXPRESSION, VARIABLES);
-		filter.put(BITWISE_OR_EXPRESSION, VARIABLES);
-		filter.put(BITWISE_AND_EXPRESSION, VARIABLES);
-		filter.put(LOGICAL_RELATION_EXPRESSION, VARIABLES_AND_OPERATIONS);
-		filter.put(SHIFT_EXPRESSION, VARIABLES);
-		filter.put(NUMERICAL_ADD_SUBTRACT_EXPRESSION, VARIABLES_AND_OPERATIONS);
-		filter.put(NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION,
+		filter.put(key(ASSIGNMENT_EXPRESSION), VARIABLES);
+		filter.put(
+				key(ASSIGNMENT_EXPRESSION, ASSIGNMENT_EXPRESSION__EXPRESSION),
+				ALL);
+		filter.put(key(CONDITIONAL_EXPRESSION), VARIABLES_AND_OPERATIONS);
+		filter.put(key(LOGICAL_OR_EXPRESSION), VARIABLES_AND_OPERATIONS);
+		filter.put(key(LOGICAL_AND_EXPRESSION), VARIABLES_AND_OPERATIONS);
+		filter.put(key(LOGICAL_NOT_EXPRESSION), VARIABLES_AND_OPERATIONS);
+		filter.put(key(BITWISE_XOR_EXPRESSION), VARIABLES);
+		filter.put(key(BITWISE_OR_EXPRESSION), VARIABLES);
+		filter.put(key(BITWISE_AND_EXPRESSION), VARIABLES);
+		filter.put(key(LOGICAL_RELATION_EXPRESSION), VARIABLES_AND_OPERATIONS);
+		filter.put(key(SHIFT_EXPRESSION), VARIABLES);
+		filter.put(key(NUMERICAL_ADD_SUBTRACT_EXPRESSION),
+				VARIABLES_AND_OPERATIONS);
+		filter.put(key(NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION),
+				VARIABLES_AND_OPERATIONS);
+		filter.put(key(NUMERICAL_UNARY_EXPRESSION), VARIABLES_AND_OPERATIONS);
+		filter.put(key(EVENT_RAISING_EXPRESSION), EVENTS);
+		filter.put(
+				key(EVENT_RAISING_EXPRESSION, EVENT_RAISING_EXPRESSION__VALUE),
 				VARIABLES_AND_OPERATIONS);
-		filter.put(NUMERICAL_UNARY_EXPRESSION, VARIABLES_AND_OPERATIONS);
-		filter.put(EVENT_RAISING_EXPRESSION, EVENTS);
-		filter.put(REGULAR_EVENT_SPEC, EVENTS);
-		filter.put(EVENT_VALUE_REFERENCE_EXPRESSION, EVENTS);
-		filter.put(REACTION_EFFECT, VARIABLES_AND_OPERATIONS);
-		filter.put(TRANSITION_REACTION, VARIABLES_AND_OPERATIONS);
-		filter.put(TRANSITION_SPECIFICATION, EVENTS);
-		filter.put(LOCAL_REACTION, VARIABLES_AND_OPERATIONS);
+		filter.put(key(REGULAR_EVENT_SPEC), EVENTS);
+		filter.put(key(EVENT_VALUE_REFERENCE_EXPRESSION), EVENTS);
+		filter.put(key(REACTION_EFFECT), VARIABLES_AND_OPERATIONS);
+		filter.put(key(TRANSITION_REACTION), VARIABLES_AND_OPERATIONS);
+		filter.put(key(TRANSITION_SPECIFICATION), EVENTS);
+		filter.put(key(LOCAL_REACTION), VARIABLES_AND_OPERATIONS);
 	}
 
-	public Predicate<IEObjectDescription> getPredicate(EClass clazz) {
-		Predicate<IEObjectDescription> predicate = filter.get(clazz);
+	public Predicate<IEObjectDescription> getPredicate(EClass clazz,
+			EReference reference) {
+		Predicate<IEObjectDescription> predicate = filter.get(key(clazz,
+				reference));
 		if (predicate == null) {
-			return EMPTY_PREDICATE;
+			predicate = filter.get(key(clazz, null));
+			if (predicate == null) {
+				return EMPTY_PREDICATE;
+			}
 		}
 		return predicate;
 	}

+ 11 - 6
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java

@@ -71,7 +71,8 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 			final EObject context, EReference reference) {
 		IScope namdScope = getNamedTopLevelScope(context, reference);
 		IScope unnamedScope = getUnnamedTopLevelScope(context, reference);
-		Predicate<IEObjectDescription> predicate = calcuateFilterPredicate(context);
+		Predicate<IEObjectDescription> predicate = calcuateFilterPredicate(
+				context, reference);
 		unnamedScope = new FilteringScope(unnamedScope, predicate);
 		return new SimpleScope(Iterables.concat(namdScope.getAllElements(),
 				unnamedScope.getAllElements()));
@@ -80,7 +81,8 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 	public IScope scope_FeatureCall_feature(final FeatureCall context,
 			EReference reference) {
 
-		Predicate<IEObjectDescription> predicate = calcuateFilterPredicate(context);
+		Predicate<IEObjectDescription> predicate = calcuateFilterPredicate(
+				context, reference);
 		Expression owner = context.getOwner();
 		if (owner instanceof TypedElementReferenceExpression) {
 			NamedElement element = ((TypedElementReferenceExpression) owner)
@@ -111,14 +113,16 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 
 	// OK
 	private Predicate<IEObjectDescription> calcuateFilterPredicate(
-			final EObject context) {
+			final EObject context, final EReference reference) {
 		Predicate<IEObjectDescription> predicate = null;
 		EObject container = context;
+		EReference ref = reference;
 		while (container != null) {
-			predicate = predicateProvider.getPredicate(container.eClass());
+			predicate = predicateProvider.getPredicate(container.eClass(), ref);
 			if (!(predicate instanceof EmptyPredicate)) {
 				break;
 			}
+			ref = (EReference) container.eContainingFeature();
 			container = container.eContainer();
 		}
 		return predicate;
@@ -170,8 +174,9 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 
 	protected Statechart getStatechart(EObject context) {
 		final ContextElementAdapter provider = (ContextElementAdapter) EcoreUtil
-				.getExistingAdapter(context.eResource(), ContextElementAdapter.class);
-		
+				.getExistingAdapter(context.eResource(),
+						ContextElementAdapter.class);
+
 		Statechart statechart = (Statechart) EcoreUtil.getObjectByType(provider
 				.getElement().eResource().getContents(),
 				SGraphPackage.Literals.STATECHART);

+ 15 - 1
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/ITypeAnalyzer.java

@@ -19,20 +19,34 @@ import com.google.inject.ImplementedBy;
 @ImplementedBy(StaticTypeAnalyzer.class)
 public interface ITypeAnalyzer {
 
+	/** true, if this type represents a boolean */
 	boolean isBoolean(Type type);
 
+	/** true, if this type represents an integer */
 	boolean isInteger(Type type);
 
+	/** true, if this type represents a real */
 	boolean isReal(Type type);
 
+	/** true, if this type represents a string */
 	boolean isString(Type type);
 
+	/** true, if this type represents void */
 	boolean isVoid(Type type);
 
-	Type inferType(Statement expr);
+	/** Cached type calculation of the statements type */
+	Type getType(Statement expr);
 
+	/**
+	 * @return true, iff the actual type is assignable to the expected type.
+	 *         (i.e. actual is a subtype of expected)
+	 */
 	boolean isAssignable(Type expected, Type actual);
 
+	/**
+	 * calculates the common supertype of typeOne and typeTwo (Could be one of
+	 * them)
+	 */
 	Type combine(Type typeOne, Type typeTwo);
 
 }

+ 36 - 28
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/StaticTypeAnalyzer.xtend

@@ -55,6 +55,9 @@ import org.yakindu.sct.model.stext.stext.StringLiteral
 import org.eclipse.xtext.validation.AbstractValidationMessageAcceptor
 import org.eclipse.xtext.EcoreUtil2
 import org.yakindu.sct.model.stext.stext.EventDerivation
+import org.eclipse.xtext.util.OnChangeEvictingCache
+import org.eclipse.emf.ecore.util.EcoreUtil
+import com.google.inject.Provider
  
 /**
  * 
@@ -63,28 +66,33 @@ import org.yakindu.sct.model.stext.stext.EventDerivation
  * @author andreas muelder - Initial contribution and API
  * 
  */
-class StaticTypeAnalyzer implements ITypeAnalyzer {
+class StaticTypeAnalyzer implements ITypeAnalyzer, StaticTypeAnalyzerCache$ICacheableTypeAnalyzer {
 	
 	@Inject 
 	TypeLibraryLocation$Registry libraries
 	@Inject
 	ITypeCheckErrorAcceptor acceptor
 	
+	@Inject StaticTypeAnalyzerCache cache
+	
+	override getType(Statement stmt) {
+		cache.get(stmt, this)
+	}
 	
 	def dispatch inferType(Statement statement){
 		null
 	}
 	
 	def check(Statement stmt) {
-		stmt.inferType
+		stmt.getType
 	}
 	
 	/**
 	 * Check Variable assignments
 	 */
 	def dispatch inferType(AssignmentExpression assignment){
-		var valueType = assignment.expression.inferType
-		var type = assignment.varRef.inferType
+		var valueType = assignment.expression.getType
+		var type = assignment.varRef.getType
 		
 		if(!isAssignable(type, valueType)){
 			error("Can not assign a value of type " + valueType?.name + " to a variable of type " + type?.name)
@@ -96,8 +104,8 @@ class StaticTypeAnalyzer implements ITypeAnalyzer {
 	 * Check Event value assignments
 	 */
 	def dispatch inferType(EventRaisingExpression eventRaising){
-		var valueType = eventRaising.value.inferType
-		var type = eventRaising.event.inferType
+		var valueType = eventRaising.value.getType
+		var type = eventRaising.event.getType
 		
 		if(!isAssignable(type, valueType)){
 			error("Can not assign a value of type " + valueType?.name + " to a variable of type " + type?.name)
@@ -107,12 +115,12 @@ class StaticTypeAnalyzer implements ITypeAnalyzer {
 	}
 	
 	def dispatch inferType(LogicalAndExpression expression){
-		return assertBooleanTypes(expression.leftOperand.inferType,
-			expression.rightOperand.inferType,'&&')
+		return assertBooleanTypes(expression.leftOperand.getType,
+			expression.rightOperand.getType,'&&')
 	}
 	def dispatch inferType(LogicalOrExpression expression){
-		return assertBooleanTypes(expression.leftOperand.inferType,
-			expression.rightOperand.inferType,'||')
+		return assertBooleanTypes(expression.leftOperand.getType,
+			expression.rightOperand.getType,'||')
 	}
 	def assertBooleanTypes(Type left, Type right, String literal) {
 		if (assertIsBoolean(left,literal) != null
@@ -122,24 +130,24 @@ class StaticTypeAnalyzer implements ITypeAnalyzer {
 		return null;
 	}
 	def dispatch inferType(LogicalNotExpression expression){
-		val type = expression.operand.inferType
+		val type = expression.operand.getType
 		return assertIsBoolean(type,'!')
 	}
 	def dispatch inferType(BitwiseAndExpression expression){
-		return assertNumericalTypes(expression.leftOperand.inferType, 
-			expression.rightOperand.inferType,'&')
+		return assertNumericalTypes(expression.leftOperand.getType, 
+			expression.rightOperand.getType,'&')
 	}
 	def dispatch inferType(BitwiseOrExpression expression){
-		return assertNumericalTypes(expression.leftOperand.inferType, 
-			expression.rightOperand.inferType,'|')
+		return assertNumericalTypes(expression.leftOperand.getType, 
+			expression.rightOperand.getType,'|')
 	}
 	def dispatch inferType(BitwiseXorExpression expression){
-		return assertNumericalTypes(expression.leftOperand.inferType, 
-			expression.rightOperand.inferType,'^')
+		return assertNumericalTypes(expression.leftOperand.getType, 
+			expression.rightOperand.getType,'^')
 	}
 	def dispatch inferType(LogicalRelationExpression expression){ 
-		val leftType = expression.leftOperand.inferType
-		val rightType = expression.rightOperand.inferType
+		val leftType = expression.leftOperand.getType
+		val rightType = expression.rightOperand.getType
 		//If both types are boolean, only relational operators Equals and not_Equals are allowed
 		if(leftType.^boolean && rightType.^boolean){
 			if(expression.operator != RelationalOperator::EQUALS && expression.operator != RelationalOperator::NOT_EQUALS){
@@ -166,17 +174,17 @@ class StaticTypeAnalyzer implements ITypeAnalyzer {
 	}
 	
 	def dispatch inferType(NumericalAddSubtractExpression expression){
-		return assertNumericalTypes(expression.leftOperand.inferType, 
-			expression.rightOperand.inferType, expression.operator.literal
+		return assertNumericalTypes(expression.leftOperand.getType, 
+			expression.rightOperand.getType, expression.operator.literal
 		)
 	}
 	def dispatch inferType(NumericalMultiplyDivideExpression expression){
-		return assertNumericalTypes(expression.leftOperand.inferType, 
-			expression.rightOperand.inferType, expression.operator.literal
+		return assertNumericalTypes(expression.leftOperand.getType, 
+			expression.rightOperand.getType, expression.operator.literal
 		)
 	}
 	def dispatch Type inferType(NumericalUnaryExpression expression){
-		val type = expression.operand.inferType
+		val type = expression.operand.getType
 		return assertIsNumber(type, expression.operator.literal)
 	}	
 	def dispatch inferType(PrimitiveValueExpression expression){
@@ -187,13 +195,13 @@ class StaticTypeAnalyzer implements ITypeAnalyzer {
 		//TODO: Implement me
 	}
 	def dispatch inferType(ConditionalExpression expression){
-		val condType = expression.condition.inferType
+		val condType = expression.condition.getType
 		if (!condType.^boolean) {
 			error("Condition type have to be boolean")
 			return null;
 		}
-		val trueType = expression.trueCase.inferType
-		val falseType = expression.falseCase.inferType
+		val trueType = expression.trueCase.getType
+		val falseType = expression.falseCase.getType
 		return combine(trueType, falseType)
 	} 
 	
@@ -224,7 +232,7 @@ class StaticTypeAnalyzer implements ITypeAnalyzer {
 		return type
 	}
 	def dispatch inferType(EventValueReferenceExpression expression){
-		return inferType(expression.value)
+		return getType(expression.value)
 	}
 	
 	def dispatch getType(IntLiteral literal){

+ 29 - 0
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/StaticTypeAnalyzerCache.java

@@ -0,0 +1,29 @@
+package org.yakindu.sct.model.stext.validation;
+
+import org.eclipse.xtext.util.OnChangeEvictingCache;
+import org.yakindu.base.types.Type;
+import org.yakindu.sct.model.sgraph.Statement;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class StaticTypeAnalyzerCache {
+	public static interface ICacheableTypeAnalyzer {
+		/**
+		 * calculate the type of the statement. This method is not directly
+		 * cached, but could delegate caches for subsequent elements
+		 */
+		public Type inferType(Statement stmt);
+	}
+
+	@Inject
+	OnChangeEvictingCache cache;
+
+	public Type get(final Statement stmt, final ICacheableTypeAnalyzer analyzer) {
+		return cache.get(stmt, stmt.eResource(), new Provider<Type>() {
+			public Type get() {
+				return analyzer.inferType(stmt);
+			}
+		});
+	}
+}

+ 159 - 154
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/StaticTypeAnalyzerTest.java

@@ -50,412 +50,417 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 	@Test
 	public void testUnarySuccess() {
 		// int
-		assertTrue(analyzer.isInteger(inferType("1")));
-		assertTrue(analyzer.isInteger(inferType("-1")));
-		assertTrue(analyzer.isInteger(inferType("0")));
-		assertTrue(analyzer.isInteger(inferType("myInt")));
+		assertTrue(analyzer.isInteger(getType("1")));
+		assertTrue(analyzer.isInteger(getType("-1")));
+		assertTrue(analyzer.isInteger(getType("0")));
+		assertTrue(analyzer.isInteger(getType("myInt")));
 		// real
-		assertTrue(analyzer.isReal(inferType("1.0")));
-		assertTrue(analyzer.isReal(inferType("-1.0")));
-		assertTrue(analyzer.isReal(inferType("0.0")));
-		assertTrue(analyzer.isReal(inferType("myReal")));
+		assertTrue(analyzer.isReal(getType("1.0")));
+		assertTrue(analyzer.isReal(getType("-1.0")));
+		assertTrue(analyzer.isReal(getType("0.0")));
+		assertTrue(analyzer.isReal(getType("myReal")));
 		// string
-		assertTrue(analyzer.isString(inferType("'42'")));
-		assertTrue(analyzer.isString(inferType("myString")));
+		assertTrue(analyzer.isString(getType("'42'")));
+		assertTrue(analyzer.isString(getType("myString")));
 		// boolean
-		assertTrue(analyzer.isBoolean(inferType("true")));
-		assertTrue(analyzer.isBoolean(inferType("false")));
-		assertTrue(analyzer.isBoolean(inferType("myBool")));
+		assertTrue(analyzer.isBoolean(getType("true")));
+		assertTrue(analyzer.isBoolean(getType("false")));
+		assertTrue(analyzer.isBoolean(getType("myBool")));
 	}
 
 	// Add
 	@Test
 	public void testAddSuccess() {
-		assertTrue(analyzer.isInteger(inferType("1 + 2")));
-		assertTrue(analyzer.isInteger(inferType("myInt + 2")));
-		assertTrue(analyzer.isReal(inferType("1.1 + 2")));
-		assertTrue(analyzer.isReal(inferType("2 + 1.0")));
-		assertTrue(analyzer.isReal(inferType("1 + 2 + 3.0")));
+		Statement statement = (Statement) super.parseExpression("1+2",
+				super.createDefaultScope(), Expression.class.getSimpleName());
+		analyzer.getType(statement);
+		assertTrue(analyzer.isInteger(analyzer.getType(statement)));
+
+		assertTrue(analyzer.isInteger(getType("1 + 2")));
+		assertTrue(analyzer.isInteger(getType("myInt + 2")));
+		assertTrue(analyzer.isReal(getType("1.1 + 2")));
+		assertTrue(analyzer.isReal(getType("2 + 1.0")));
+		assertTrue(analyzer.isReal(getType("1 + 2 + 3.0")));
 	}
 
 	@Test
 	public void testAddException1() {
 		expectOperatorPlusException();
-		inferType("true + 5");
+		getType("true + 5");
 	}
 
 	@Test
 	public void testAddException2() {
 		expectOperatorPlusException();
-		inferType("false + 5");
+		getType("false + 5");
 	}
 
 	@Test
 	public void testAddException3() {
 		expectOperatorPlusException();
-		inferType("5 + false");
+		getType("5 + false");
 	}
 
 	@Test
 	public void testAddException4() {
 		expectOperatorPlusException();
-		inferType("true + (3 * 5)");
+		getType("true + (3 * 5)");
 	}
 
 	@Test
 	public void testAddException5() {
 		expectOperatorPlusException();
-		inferType("(3 * 5) + true");
+		getType("(3 * 5) + true");
 	}
 
 	@Test
 	public void testAddException6() {
 		expectOperatorPlusException();
-		inferType("3.0 +  true");
+		getType("3.0 +  true");
 	}
 
 	@Test
 	public void testAddException7() {
 		expectOperatorPlusException();
-		inferType("3.0 + 'string'");
+		getType("3.0 + 'string'");
 	}
 
 	@Test
 	public void testAddException8() {
 		expectOperatorPlusException();
-		inferType("myInt + 'string'");
+		getType("myInt + 'string'");
 	}
 
 	// substract
 	@Test
 	public void testSubstractSuccess() {
-		assertTrue(analyzer.isInteger(inferType("1 - 2")));
-		assertTrue(analyzer.isInteger(inferType("myInt - 2")));
-		assertTrue(analyzer.isReal(inferType("1.0 - 2")));
-		assertTrue(analyzer.isReal(inferType("2 - 1.0")));
-		assertTrue(analyzer.isReal(inferType("myReal - 1.0")));
-		assertTrue(analyzer.isReal(inferType("1 - 2 - 3.0")));
+		assertTrue(analyzer.isInteger(getType("1 - 2")));
+		assertTrue(analyzer.isInteger(getType("myInt - 2")));
+		assertTrue(analyzer.isReal(getType("1.0 - 2")));
+		assertTrue(analyzer.isReal(getType("2 - 1.0")));
+		assertTrue(analyzer.isReal(getType("myReal - 1.0")));
+		assertTrue(analyzer.isReal(getType("1 - 2 - 3.0")));
 	}
 
 	@Test
 	public void testSubstractException1() {
 		expectOperatorSubstractException();
-		inferType("true - 5");
+		getType("true - 5");
 	}
 
 	@Test
 	public void testSubstractException2() {
 		expectOperatorSubstractException();
-		inferType("false - 5");
+		getType("false - 5");
 	}
 
 	@Test
 	public void testSubstractException3() {
 		expectOperatorSubstractException();
-		inferType("5 - false");
+		getType("5 - false");
 	}
 
 	@Test
 	public void testSubstractException4() {
 		expectOperatorSubstractException();
-		inferType("true - (3 * 5)");
+		getType("true - (3 * 5)");
 	}
 
 	@Test
 	public void testSubstractException5() {
 		expectOperatorSubstractException();
-		inferType("(3 * 5) - true");
+		getType("(3 * 5) - true");
 	}
 
 	@Test
 	public void testSubstractException6() {
 		expectOperatorSubstractException();
-		inferType("3.0 -  true");
+		getType("3.0 -  true");
 	}
 
 	@Test
 	public void testSubstractException7() {
 		expectOperatorSubstractException();
-		inferType("3.0 -  'string'");
+		getType("3.0 -  'string'");
 	}
 
 	@Test
 	public void testSubstractException8() {
 		expectOperatorSubstractException();
-		inferType("myReal -  'string'");
+		getType("myReal -  'string'");
 	}
 
 	// multiply
 	@Test
 	public void testMultiplySuccess() {
-		assertTrue(analyzer.isInteger(inferType("1 * 2")));
-		assertTrue(analyzer.isReal(inferType("myInt * myReal")));
-		assertTrue(analyzer.isReal(inferType("1.0 * 2")));
-		assertTrue(analyzer.isReal(inferType("2 * 1.0")));
-		assertTrue(analyzer.isReal(inferType("1 * 2 * 3.0")));
+		assertTrue(analyzer.isInteger(getType("1 * 2")));
+		assertTrue(analyzer.isReal(getType("myInt * myReal")));
+		assertTrue(analyzer.isReal(getType("1.0 * 2")));
+		assertTrue(analyzer.isReal(getType("2 * 1.0")));
+		assertTrue(analyzer.isReal(getType("1 * 2 * 3.0")));
 	}
 
 	@Test
 	public void testMultiplyException1() {
 		expectOperatorMultiplyException();
-		inferType("true * 5");
+		getType("true * 5");
 	}
 
 	@Test
 	public void testMultiplyException2() {
 		expectOperatorMultiplyException();
-		inferType("false * 5");
+		getType("false * 5");
 	}
 
 	@Test
 	public void testMultiplyException3() {
 		expectOperatorMultiplyException();
-		inferType("5 * false");
+		getType("5 * false");
 	}
 
 	@Test
 	public void testMultiplyException4() {
 		expectOperatorMultiplyException();
-		inferType("true * (3 - 5)");
+		getType("true * (3 - 5)");
 	}
 
 	@Test
 	public void testMultiplyException5() {
 		expectOperatorMultiplyException();
-		inferType("(3 + 5) * true");
+		getType("(3 + 5) * true");
 	}
 
 	@Test
 	public void testMultiplyException6() {
 		expectOperatorMultiplyException();
-		inferType("3.0 *  true");
+		getType("3.0 *  true");
 	}
 
 	@Test
 	public void testMultiplyException7() {
 		expectOperatorMultiplyException();
-		inferType("3.0 *  'string'");
+		getType("3.0 *  'string'");
 	}
 
 	@Test
 	public void testMultiplyException8() {
 		expectOperatorMultiplyException();
-		inferType("myReal *  'string'");
+		getType("myReal *  'string'");
 	}
 
 	// divide
 	@Test
 	public void testDivideSuccess() {
-		assertTrue(analyzer.isInteger(inferType("1 / 2")));
-		assertTrue(analyzer.isInteger(inferType("1 / myInt")));
-		assertTrue(analyzer.isReal(inferType("1.0 / 2")));
-		assertTrue(analyzer.isReal(inferType("2 / 1.0")));
-		assertTrue(analyzer.isReal(inferType("1 / 2 / 3.0")));
+		assertTrue(analyzer.isInteger(getType("1 / 2")));
+		assertTrue(analyzer.isInteger(getType("1 / myInt")));
+		assertTrue(analyzer.isReal(getType("1.0 / 2")));
+		assertTrue(analyzer.isReal(getType("2 / 1.0")));
+		assertTrue(analyzer.isReal(getType("1 / 2 / 3.0")));
 	}
 
 	@Test
 	public void testDivideException1() {
 		expectOperatorDivideException();
-		inferType("true / 5");
+		getType("true / 5");
 	}
 
 	@Test
 	public void testDivideException2() {
 		expectOperatorDivideException();
-		inferType("false / 5");
+		getType("false / 5");
 	}
 
 	@Test
 	public void testDivideException3() {
 		expectOperatorDivideException();
-		inferType("5 / false");
+		getType("5 / false");
 	}
 
 	@Test
 	public void testDivideException4() {
 		expectOperatorDivideException();
-		inferType("true / (3 - 5)");
+		getType("true / (3 - 5)");
 	}
 
 	@Test
 	public void testDivideException5() {
 		expectOperatorDivideException();
-		inferType("(3 + 5) / true");
+		getType("(3 + 5) / true");
 	}
 
 	@Test
 	public void testDivideException6() {
 		expectOperatorDivideException();
-		inferType("3.0 /  true");
+		getType("3.0 /  true");
 	}
 
 	@Test
 	public void testDivideException7() {
 		expectOperatorDivideException();
-		inferType("3.0 /  'string'");
+		getType("3.0 /  'string'");
 	}
 
 	@Test
 	public void testDivideException8() {
 		expectOperatorDivideException();
-		inferType("3.0 /  myString");
+		getType("3.0 /  myString");
 	}
 
 	// mod
 	@Test
 	public void testModSuccess() {
-		assertTrue(analyzer.isInteger(inferType("1 % 2")));
-		assertTrue(analyzer.isReal(inferType("1.0 % 2")));
-		assertTrue(analyzer.isReal(inferType("2 % 1.0")));
-		assertTrue(analyzer.isReal(inferType("2 % myReal")));
-		assertTrue(analyzer.isReal(inferType("1 % 2 % 3.0")));
+		assertTrue(analyzer.isInteger(getType("1 % 2")));
+		assertTrue(analyzer.isReal(getType("1.0 % 2")));
+		assertTrue(analyzer.isReal(getType("2 % 1.0")));
+		assertTrue(analyzer.isReal(getType("2 % myReal")));
+		assertTrue(analyzer.isReal(getType("1 % 2 % 3.0")));
 	}
 
 	@Test
 	public void testModException1() {
 		expectOperatorModException();
-		inferType("true % 5");
+		getType("true % 5");
 	}
 
 	@Test
 	public void testModException2() {
 		expectOperatorModException();
-		inferType("false % 5");
+		getType("false % 5");
 	}
 
 	@Test
 	public void testModException3() {
 		expectOperatorModException();
-		inferType("5 % false");
+		getType("5 % false");
 	}
 
 	@Test
 	public void testModException4() {
 		expectOperatorModException();
-		inferType("true % (3 - 5)");
+		getType("true % (3 - 5)");
 	}
 
 	@Test
 	public void testModException5() {
 		expectOperatorModException();
-		inferType("(3 + 5) % true");
+		getType("(3 + 5) % true");
 	}
 
 	@Test
 	public void testModException6() {
 		expectOperatorModException();
-		inferType("3.0 % true");
+		getType("3.0 % true");
 	}
 
 	@Test
 	public void testModException7() {
 		expectOperatorModException();
-		inferType("3.0 % 'string'");
+		getType("3.0 % 'string'");
 	}
 
 	@Test
 	public void testModException8() {
 		expectOperatorModException();
-		inferType("3.0 % myString");
+		getType("3.0 % myString");
 	}
 
 	// Logical And Or Not
 	@Test
 	public void testLogicalSuccess() {
-		assertTrue(analyzer.isBoolean(inferType("true || false")));
-		assertTrue(analyzer.isBoolean(inferType("true || myBool")));
-		assertTrue(analyzer.isBoolean(inferType("true || false && true")));
+		assertTrue(analyzer.isBoolean(getType("true || false")));
+		assertTrue(analyzer.isBoolean(getType("true || myBool")));
+		assertTrue(analyzer.isBoolean(getType("true || false && true")));
 		assertTrue(analyzer
-				.isBoolean(inferType("true || true &&( false || true)")));
-		assertTrue(analyzer.isBoolean(inferType("!true")));
-		assertTrue(analyzer.isBoolean(inferType("!myBool")));
-		assertTrue(analyzer.isBoolean(inferType("!true && !false")));
+				.isBoolean(getType("true || true &&( false || true)")));
+		assertTrue(analyzer.isBoolean(getType("!true")));
+		assertTrue(analyzer.isBoolean(getType("!myBool")));
+		assertTrue(analyzer.isBoolean(getType("!true && !false")));
 	}
 
 	@Test
 	public void testLogicalException1() {
 		expectLogicalAndException();
-		inferType("true && 5");
+		getType("true && 5");
 	}
 
 	@Test
 	public void testLogicalException2() {
 		expectLogicalOrException();
-		inferType("false || 5");
+		getType("false || 5");
 	}
 
 	@Test
 	public void testLogicalException3() {
 		expectLogicalAndException();
-		inferType("5 && false");
+		getType("5 && false");
 	}
 
 	@Test
 	public void testLogicalException4() {
 		expectLogicalAndException();
-		inferType("true && (3 - 5)");
+		getType("true && (3 - 5)");
 	}
 
 	@Test
 	public void testLogicalException5() {
 		expectLogicalOrException();
-		inferType("(3 + 5) || true");
+		getType("(3 + 5) || true");
 	}
 
 	@Test
 	public void testLogicalException6() {
 		expectLogicalAndException();
-		inferType("3.0 &&  true");
+		getType("3.0 &&  true");
 	}
 
 	@Test
 	public void testLogicalException7() {
 		expectLogicalNotException();
-		inferType("!3");
+		getType("!3");
 	}
 
 	@Test
 	public void testLogicalException8() {
 		expectLogicalNotException();
-		inferType("!1.2");
+		getType("!1.2");
 	}
 
 	@Test
 	public void testLogicalException9() {
 		expectLogicalNotException();
-		inferType("!'Test'");
+		getType("!'Test'");
 	}
 
 	@Test
 	public void testLogicalException10() {
 		expectLogicalNotException();
-		inferType("!myString");
+		getType("!myString");
 	}
 
 	// LogicalRelation
 	@Test
 	public void testLogicalRelationSuccess() {
-		assertTrue(analyzer.isBoolean(inferType("5 < 3")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 < 3")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 < myInt")));
+		assertTrue(analyzer.isBoolean(getType("5 < 3")));
+		assertTrue(analyzer.isBoolean(getType("5.0 < 3")));
+		assertTrue(analyzer.isBoolean(getType("5.0 < myInt")));
 
-		assertTrue(analyzer.isBoolean(inferType("5 <= 3")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 <= 3")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 <= myInt")));
+		assertTrue(analyzer.isBoolean(getType("5 <= 3")));
+		assertTrue(analyzer.isBoolean(getType("5.0 <= 3")));
+		assertTrue(analyzer.isBoolean(getType("5.0 <= myInt")));
 
-		assertTrue(analyzer.isBoolean(inferType("5 > 3")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 >= 3")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 >= myInt")));
+		assertTrue(analyzer.isBoolean(getType("5 > 3")));
+		assertTrue(analyzer.isBoolean(getType("5.0 >= 3")));
+		assertTrue(analyzer.isBoolean(getType("5.0 >= myInt")));
 
-		assertTrue(analyzer.isBoolean(inferType("5 == 3")));
-		assertTrue(analyzer.isBoolean(inferType("'string' == 'string'")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 == 3")));
-		assertTrue(analyzer.isBoolean(inferType("true == myBool")));
+		assertTrue(analyzer.isBoolean(getType("5 == 3")));
+		assertTrue(analyzer.isBoolean(getType("'string' == 'string'")));
+		assertTrue(analyzer.isBoolean(getType("5.0 == 3")));
+		assertTrue(analyzer.isBoolean(getType("true == myBool")));
 
-		assertTrue(analyzer.isBoolean(inferType("5 != 3")));
-		assertTrue(analyzer.isBoolean(inferType("'string' != 'string'")));
-		assertTrue(analyzer.isBoolean(inferType("5.0 != 3")));
-		assertTrue(analyzer.isBoolean(inferType("true != myBool")));
+		assertTrue(analyzer.isBoolean(getType("5 != 3")));
+		assertTrue(analyzer.isBoolean(getType("'string' != 'string'")));
+		assertTrue(analyzer.isBoolean(getType("5.0 != 3")));
+		assertTrue(analyzer.isBoolean(getType("true != myBool")));
 	}
 
 	@Test
@@ -463,7 +468,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '<'");
-		inferType("3.0 < true");
+		getType("3.0 < true");
 	}
 
 	@Test
@@ -471,7 +476,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands string and integer for operator '<'");
-		inferType("'string' < 5");
+		getType("'string' < 5");
 	}
 
 	@Test
@@ -479,7 +484,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '<'");
-		inferType("1.0 < false");
+		getType("1.0 < false");
 	}
 
 	@Test
@@ -487,7 +492,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '<='");
-		inferType("3.0 <= true");
+		getType("3.0 <= true");
 	}
 
 	@Test
@@ -495,7 +500,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands string and integer for operator '<='");
-		inferType("'string' <= 5");
+		getType("'string' <= 5");
 	}
 
 	@Test
@@ -503,7 +508,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '<='");
-		inferType("1.0 <= false");
+		getType("1.0 <= false");
 	}
 
 	@Test
@@ -511,7 +516,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '>'");
-		inferType("3.0 > true");
+		getType("3.0 > true");
 	}
 
 	@Test
@@ -519,7 +524,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands string and integer for operator '>'");
-		inferType("'string' > 5");
+		getType("'string' > 5");
 	}
 
 	@Test
@@ -527,7 +532,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '>'");
-		inferType("1.0 > false");
+		getType("1.0 > false");
 	}
 
 	@Test
@@ -535,7 +540,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '>='");
-		inferType("3.0 >= true");
+		getType("3.0 >= true");
 	}
 
 	@Test
@@ -543,7 +548,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands string and integer for operator '>='");
-		inferType("'string' >= 5");
+		getType("'string' >= 5");
 	}
 
 	@Test
@@ -551,7 +556,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '>='");
-		inferType("1.0 >= false");
+		getType("1.0 >= false");
 	}
 
 	@Test
@@ -559,7 +564,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '=='");
-		inferType("3.0 == true");
+		getType("3.0 == true");
 	}
 
 	@Test
@@ -567,7 +572,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands string and integer for operator '=='");
-		inferType("'string' == 5");
+		getType("'string' == 5");
 	}
 
 	@Test
@@ -575,7 +580,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '=='");
-		inferType("1.0 == false");
+		getType("1.0 == false");
 	}
 
 	@Test
@@ -583,7 +588,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '!='");
-		inferType("3.0 != true");
+		getType("3.0 != true");
 	}
 
 	@Test
@@ -591,7 +596,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands string and integer for operator '!='");
-		inferType("'string' != 5");
+		getType("'string' != 5");
 	}
 
 	@Test
@@ -599,15 +604,15 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Incompatible operands real and boolean for operator '!='");
-		inferType("1.0 != false");
+		getType("1.0 != false");
 	}
 
 	@Test
 	public void testAssignmentSuccess() {
-		inferType("myInt = 5 * 3");
-		inferType("myBool = true || false");
-		inferType("myString = 'string'");
-		inferType("myReal = 2.0 - 7");
+		getType("myInt = 5 * 3");
+		getType("myBool = true || false");
+		getType("myString = 'string'");
+		getType("myReal = 2.0 - 7");
 	}
 
 	@Test
@@ -615,7 +620,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Can not assign a value of type boolean to a variable of type integer");
-		inferType("myInt = true");
+		getType("myInt = true");
 	}
 
 	@Test
@@ -623,14 +628,14 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		exception.expect(TypeCheckException.class);
 		exception
 				.expectMessage("Can not assign a value of type boolean to a variable of type integer");
-		inferType("myInt = myBool");
+		getType("myInt = myBool");
 	}
 
 	@Test
 	public void testComplexExpressionsSuccess() {
-		analyzer.isBoolean(inferType("((((3 * myInt) + 5) % 2) > 97) || false"));
-		analyzer.isBoolean(inferType("!true != myBool && (3 > (myReal * 5 + 3))"));
-		analyzer.isInteger(inferType("3 * 3 + 7 / (3 * myInt % 8)"));
+		analyzer.isBoolean(getType("((((3 * myInt) + 5) % 2) > 97) || false"));
+		analyzer.isBoolean(getType("!true != myBool && (3 > (myReal * 5 + 3))"));
+		analyzer.isInteger(getType("3 * 3 + 7 / (3 * myInt % 8)"));
 	}
 
 	// TODO: BitwiseOrExpression, BitwiseAndExpression, BitwiseXOrExpression
@@ -642,19 +647,19 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		// int events
 		EObject statement = super.parseExpression("raise intEvent : 42",
 				context, EventRaisingExpression.class.getSimpleName());
-		analyzer.inferType((Statement) statement);
+		analyzer.getType((Statement) statement);
 		// bool events
 		statement = super.parseExpression("raise boolEvent : myBool", context,
 				EventRaisingExpression.class.getSimpleName());
-		analyzer.inferType((Statement) statement);
+		analyzer.getType((Statement) statement);
 		// real events
 		statement = super.parseExpression("raise realEvent : 2.0 - 3.0",
 				context, EventRaisingExpression.class.getSimpleName());
-		analyzer.inferType((Statement) statement);
+		analyzer.getType((Statement) statement);
 		// string events
 		statement = super.parseExpression("raise stringEvent : 'string'",
 				context, EventRaisingExpression.class.getSimpleName());
-		analyzer.inferType((Statement) statement);
+		analyzer.getType((Statement) statement);
 	}
 
 	@Test
@@ -663,30 +668,30 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		// int events
 		EObject statement = super.parseExpression("valueof(intEvent)", context,
 				EventValueReferenceExpression.class.getSimpleName());
-		analyzer.isInteger(analyzer.inferType((Statement) statement));
+		analyzer.isInteger(analyzer.getType((Statement) statement));
 		// bool events
 		statement = super.parseExpression("valueof(boolEvent)", context,
 				EventValueReferenceExpression.class.getSimpleName());
-		analyzer.isBoolean(analyzer.inferType((Statement) statement));
+		analyzer.isBoolean(analyzer.getType((Statement) statement));
 		// real events
 		statement = super.parseExpression("valueof(realEvent)", context,
 				EventValueReferenceExpression.class.getSimpleName());
-		analyzer.isReal(analyzer.inferType((Statement) statement));
+		analyzer.isReal(analyzer.getType((Statement) statement));
 		// string events
 		statement = super.parseExpression("valueof(stringEvent)", context,
 				EventValueReferenceExpression.class.getSimpleName());
-		analyzer.isString(analyzer.inferType((Statement) statement));
+		analyzer.isString(analyzer.getType((Statement) statement));
 		// void events
 		statement = super.parseExpression("valueof(voidEvent)", context,
 				EventValueReferenceExpression.class.getSimpleName());
-		analyzer.isVoid(analyzer.inferType((Statement) statement));
+		analyzer.isVoid(analyzer.getType((Statement) statement));
 	}
 
 	@Test
 	public void testEventIsRaisedSuccess() {
 		EObject statement = super.parseExpression("myBool = abc",
 				createDefaultScope(), Expression.class.getSimpleName());
-		analyzer.inferType((Statement) statement);
+		analyzer.getType((Statement) statement);
 	}
 
 	@Test
@@ -697,7 +702,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		EObject statement = super.parseExpression("raise intEvent : true",
 				createValuedEventsScope(),
 				EventRaisingExpression.class.getSimpleName());
-		analyzer.inferType((Statement) statement);
+		analyzer.getType((Statement) statement);
 	}
 
 	@Test
@@ -708,7 +713,7 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		EObject statement = super.parseExpression("raise intEvent : myBool",
 				createValuedEventsScope(),
 				EventRaisingExpression.class.getSimpleName());
-		analyzer.inferType((Statement) statement);
+		analyzer.getType((Statement) statement);
 	}
 
 	/**
@@ -761,11 +766,11 @@ public class StaticTypeAnalyzerTest extends AbstractSTextTest {
 		return createContextScope("internal: var myBool : boolean event intEvent : integer = 22 event boolEvent : boolean event realEvent : real event stringEvent : string event voidEvent : void");
 	}
 
-	protected Type inferType(String expression) {
+	protected Type getType(String expression) {
 		EObject statement = super.parseExpression(expression,
 				super.createDefaultScope(), Expression.class.getSimpleName());
 		assertNotNull(statement);
-		return analyzer.inferType((Statement) statement);
+		return analyzer.getType((Statement) statement);
 	}
 
 }

+ 3 - 5
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/util/AbstractSTextTest.java

@@ -66,11 +66,6 @@ public abstract class AbstractSTextTest {
 	protected EObject parseExpression(String expression, Scope context,
 			String ruleName) {
 		XtextResource resource = getResource();
-		if (context != null) {
-			Statechart sc = _createStatechart("myStatechart");
-			resource.getContents().add(sc);
-			sc.getScopes().add(context);
-		}
 		resource.setURI(URI.createPlatformPluginURI("path", true));
 		ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
 		parserRule.setName(ruleName);
@@ -80,6 +75,9 @@ public abstract class AbstractSTextTest {
 		resource.getContents().add(rootASTElement);
 		ListBasedDiagnosticConsumer diagnosticsConsumer = new ListBasedDiagnosticConsumer();
 		if (context != null) {
+			Statechart sc = _createStatechart("");
+			resource.getContents().add(sc);
+			sc.getScopes().add(context);
 			resource.getContents().add(context);
 			linker.linkModel(context, diagnosticsConsumer);
 		}