diff --git a/plugins/org.etsi.mts.tdl.TDLan2/src/org/etsi/mts/tdl/scoping/TDLan2ScopeProvider.java b/plugins/org.etsi.mts.tdl.TDLan2/src/org/etsi/mts/tdl/scoping/TDLan2ScopeProvider.java index 550f9ec204f42c9d4bade72274dd3f506e0ea45e..2b3d3cd08f7160ccfab3367399cb43f72d200384 100644 --- a/plugins/org.etsi.mts.tdl.TDLan2/src/org/etsi/mts/tdl/scoping/TDLan2ScopeProvider.java +++ b/plugins/org.etsi.mts.tdl.TDLan2/src/org/etsi/mts/tdl/scoping/TDLan2ScopeProvider.java @@ -16,12 +16,16 @@ import org.etsi.mts.tdl.ComponentInstance; import org.etsi.mts.tdl.Connection; import org.etsi.mts.tdl.DataElementMapping; import org.etsi.mts.tdl.DataInstanceUse; +import org.etsi.mts.tdl.DataUse; import org.etsi.mts.tdl.Element; +import org.etsi.mts.tdl.FormalParameterUse; import org.etsi.mts.tdl.FunctionCall; import org.etsi.mts.tdl.GateInstance; import org.etsi.mts.tdl.GateReference; import org.etsi.mts.tdl.LocalExpression; +import org.etsi.mts.tdl.Member; import org.etsi.mts.tdl.MemberAssignment; +import org.etsi.mts.tdl.MemberReference; import org.etsi.mts.tdl.Parameter; import org.etsi.mts.tdl.ParameterBinding; import org.etsi.mts.tdl.ParameterMapping; @@ -49,7 +53,6 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider { @Override public IScope getScope(EObject context, EReference reference) { - if (reference.getEType().getInstanceClass() == GateInstance.class) { if (context instanceof GateReference) { GateReference gate = (GateReference) context; @@ -119,6 +122,36 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider { return scope; // } } + } else if (context instanceof MemberReference) { + if (((DataUse)context.eContainer()).getReduction().indexOf(context)>0) { + EObject targetContext = ((DataUse)context.eContainer()).getReduction().get(((DataUse)context.eContainer()).getReduction().indexOf(context)-1); + if (((MemberReference)targetContext).getMember().getDataType() instanceof StructuredDataType) { + IScope scope = Scopes.scopeFor(((StructuredDataType)((MemberReference)targetContext).getMember().getDataType()).getMember()); + return scope; + } + } else + if (context.eContainer() instanceof DataInstanceUse) { + if (((DataInstanceUse)context.eContainer()).getDataInstance() instanceof StructuredDataInstance) { + IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance)((DataInstanceUse)context.eContainer()).getDataInstance()).getDataType()).getMember()); + return scope; + } + } else if (context.eContainer() instanceof FunctionCall) { + if (((FunctionCall)context.eContainer()).getFunction().getReturnType() instanceof StructuredDataType) { + IScope scope = Scopes.scopeFor(((StructuredDataType)((FunctionCall)context.eContainer()).getFunction().getReturnType()).getMember()); + return scope; + } + } else if (context.eContainer() instanceof FormalParameterUse) { + if (((FormalParameterUse)context.eContainer()).getParameter().getDataType() instanceof StructuredDataType) { + IScope scope = Scopes.scopeFor(((StructuredDataType)((FormalParameterUse)context.eContainer()).getParameter().getDataType()).getMember()); + return scope; + } + } else if (context.eContainer() instanceof VariableUse) { + if (((VariableUse)context.eContainer()).getVariable().getDataType() instanceof StructuredDataType) { + IScope scope = Scopes.scopeFor(((StructuredDataType)((VariableUse)context.eContainer()).getVariable().getDataType()).getMember()); + return scope; + } + } else { + } } } else if (reference.getEType().getInstanceClass() == Variable.class) { if (context instanceof Assignment) { @@ -141,7 +174,8 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider { } } else { } - + + if (context instanceof Block) { TestDescription testDescription = getTestDescription((Element) context); if (testDescription!=null) {