Commit aa7d31d0 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ scoping refinements



Change-Id: I34b5622fd6de6f0c5000ce9ef256355dca8b11a1
Signed-off-by: default avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent 8d59a9f7
Loading
Loading
Loading
Loading
+25 −3
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@ import org.etsi.mts.tdl.Assignment;
import org.etsi.mts.tdl.Behaviour;
import org.etsi.mts.tdl.Behaviour;
import org.etsi.mts.tdl.Block;
import org.etsi.mts.tdl.Block;
import org.etsi.mts.tdl.ComponentInstance;
import org.etsi.mts.tdl.ComponentInstance;
import org.etsi.mts.tdl.ComponentInstanceBinding;
import org.etsi.mts.tdl.Connection;
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;
@@ -38,8 +39,13 @@ import org.etsi.mts.tdl.StructuredDataType;
import org.etsi.mts.tdl.Target;
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.TestDescriptionReference;
import org.etsi.mts.tdl.Timer;
import org.etsi.mts.tdl.TimerOperation;
import org.etsi.mts.tdl.Variable;
import org.etsi.mts.tdl.Variable;
import org.etsi.mts.tdl.VariableUse;
import org.etsi.mts.tdl.VariableUse;
import org.etsi.mts.tdl.tdlPackage;
import org.etsi.mts.tdl.impl.ComponentInstanceBindingImpl;


import com.google.common.base.Function;
import com.google.common.base.Function;
import com.google.inject.Inject;
import com.google.inject.Inject;
@@ -81,6 +87,16 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
				EList<ComponentInstance> components = configuration.getComponentInstance();
				EList<ComponentInstance> components = configuration.getComponentInstance();
				IScope scope = Scopes.scopeFor(components);
				IScope scope = Scopes.scopeFor(components);
				return scope;
				return scope;
			} else if (context instanceof ComponentInstanceBinding) {
				//assume actual
				TestDescription testDescription = getTestDescription((Element) context);
				if (reference.getFeatureID() == tdlPackage.eINSTANCE.COMPONENT_INSTANCE_BINDING__FORMAL_COMPONENT) {
					testDescription = ((TestDescriptionReference)context.eContainer()).getTestDescription();
				}
				TestConfiguration configuration = testDescription.getTestConfiguration();
				EList<ComponentInstance> components = configuration.getComponentInstance();
				IScope scope = Scopes.scopeFor(components);
				return scope;
			} 
			} 
		} else if (reference.getEType().getInstanceClass() == GateReference.class) {
		} else if (reference.getEType().getInstanceClass() == GateReference.class) {
			//TODO: safety checks in case invalid configuration is specified
			//TODO: safety checks in case invalid configuration is specified
@@ -142,8 +158,11 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
						IScope scope = Scopes.scopeFor(((FunctionCall)context.eContainer()).getFunction().getFormalParameter());
						IScope scope = Scopes.scopeFor(((FunctionCall)context.eContainer()).getFunction().getFormalParameter());
						return scope;
						return scope;
//					}
//					}
				} else if (context.eContainer() instanceof FunctionCall) {
				} else if (context.eContainer() instanceof FormalParameterUse) {
					IScope scope = Scopes.scopeFor(((FunctionCall)context.eContainer()).getFunction().getFormalParameter());
					IScope scope = Scopes.scopeFor(((StructuredDataType)((FormalParameterUse)context.eContainer()).getParameter().getDataType()).getMember());
					return scope;
				} else if (context.eContainer() instanceof VariableUse) {
					IScope scope = Scopes.scopeFor(((StructuredDataType)((VariableUse)context.eContainer()).getVariable().getDataType()).getMember());
					return scope;
					return scope;
				}
				}
			} else if (context instanceof MemberReference) {
			} else if (context instanceof MemberReference) {
@@ -198,6 +217,9 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
					return scope;
					return scope;
				}
				}
			}
			}
		} else if (reference.getEType().getInstanceClass() == Timer.class) {
			IScope scope = Scopes.scopeFor(((TimerOperation)context).getComponentInstance().getType().getTimer());
			return scope;
		} else {
		} else {
		}
		}