Commit 3e140365 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ fixed support for variable uses and function call arguments



Change-Id: Ied346deb58501b3a1d4e42fbfc67195e4d47c95e
Signed-off-by: default avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent e4534bb8
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ import org.etsi.mts.tdl.Connection;
import org.etsi.mts.tdl.DataElementMapping;
import org.etsi.mts.tdl.DataElementMapping;
import org.etsi.mts.tdl.DataInstanceUse;
import org.etsi.mts.tdl.DataInstanceUse;
import org.etsi.mts.tdl.Element;
import org.etsi.mts.tdl.Element;
import org.etsi.mts.tdl.FunctionCall;
import org.etsi.mts.tdl.GateInstance;
import org.etsi.mts.tdl.GateInstance;
import org.etsi.mts.tdl.GateReference;
import org.etsi.mts.tdl.GateReference;
import org.etsi.mts.tdl.LocalExpression;
import org.etsi.mts.tdl.LocalExpression;
@@ -30,6 +31,7 @@ import org.etsi.mts.tdl.Target;
import org.etsi.mts.tdl.TestConfiguration;
import org.etsi.mts.tdl.TestConfiguration;
import org.etsi.mts.tdl.TestDescription;
import org.etsi.mts.tdl.TestDescription;
import org.etsi.mts.tdl.Variable;
import org.etsi.mts.tdl.Variable;
import org.etsi.mts.tdl.VariableUse;


import com.google.common.base.Function;
import com.google.common.base.Function;
import com.google.inject.Inject;
import com.google.inject.Inject;
@@ -55,7 +57,7 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
				return scope;
				return scope;
			}
			}
		} else if (reference.getEType().getInstanceClass() == ComponentInstance.class) {
		} else if (reference.getEType().getInstanceClass() == ComponentInstance.class) {
			if (context instanceof Behaviour || context instanceof Block || context instanceof LocalExpression) {
			if (context instanceof Behaviour || context instanceof Block || context instanceof LocalExpression || context instanceof VariableUse) {
				TestDescription testDescription = getTestDescription((Element) context);
				TestDescription testDescription = getTestDescription((Element) context);
				if (testDescription!=null) {
				if (testDescription!=null) {
					TestConfiguration configuration = testDescription.getTestConfiguration();
					TestConfiguration configuration = testDescription.getTestConfiguration();
@@ -111,6 +113,11 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
						IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance)((DataInstanceUse)context.eContainer()).getDataInstance()).getDataType()).getMember());
						IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance)((DataInstanceUse)context.eContainer()).getDataInstance()).getDataType()).getMember());
						return scope;
						return scope;
					}
					}
				} else if (context.eContainer() instanceof FunctionCall) {
//					if (((FunctionCall)context.eContainer()).getFunction().get instanceof StructuredDataInstance) {
						IScope scope = Scopes.scopeFor(((FunctionCall)context.eContainer()).getFunction().getFormalParameter());
						return scope;
//					}
				}
				}
			}
			}
		} else if (reference.getEType().getInstanceClass() == Variable.class) {
		} else if (reference.getEType().getInstanceClass() == Variable.class) {
@@ -120,6 +127,12 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
					return scope;
					return scope;
				}
				}
			}
			}
			if (context instanceof VariableUse) {
				if (((VariableUse)context).getComponentInstance()!=null) {
					IScope scope = Scopes.scopeFor(((VariableUse)context).getComponentInstance().getType().getVariable());
					return scope;
				}
			}
			else if (context instanceof Target) {
			else if (context instanceof Target) {
				if (((Target)context).getTargetGate().getComponent()!=null) {
				if (((Target)context).getTargetGate().getComponent()!=null) {
					IScope scope = Scopes.scopeFor(((Target)context).getTargetGate().getComponent().getType().getVariable());
					IScope scope = Scopes.scopeFor(((Target)context).getTargetGate().getComponent().getType().getVariable());