Skip to content
Snippets Groups Projects
Commit adb5f19c authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ further refinements for scoping of reductions


Change-Id: Iaad19c63f7f2b835a241fb1842de70e8a305635b
Signed-off-by: default avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent d7448340
No related branches found
No related tags found
No related merge requests found
...@@ -16,12 +16,16 @@ import org.etsi.mts.tdl.ComponentInstance; ...@@ -16,12 +16,16 @@ import org.etsi.mts.tdl.ComponentInstance;
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;
import org.etsi.mts.tdl.DataUse;
import org.etsi.mts.tdl.Element; import org.etsi.mts.tdl.Element;
import org.etsi.mts.tdl.FormalParameterUse;
import org.etsi.mts.tdl.FunctionCall; 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;
import org.etsi.mts.tdl.Member;
import org.etsi.mts.tdl.MemberAssignment; import org.etsi.mts.tdl.MemberAssignment;
import org.etsi.mts.tdl.MemberReference;
import org.etsi.mts.tdl.Parameter; import org.etsi.mts.tdl.Parameter;
import org.etsi.mts.tdl.ParameterBinding; import org.etsi.mts.tdl.ParameterBinding;
import org.etsi.mts.tdl.ParameterMapping; import org.etsi.mts.tdl.ParameterMapping;
...@@ -49,7 +53,6 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider { ...@@ -49,7 +53,6 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
@Override @Override
public IScope getScope(EObject context, EReference reference) { public IScope getScope(EObject context, EReference reference) {
if (reference.getEType().getInstanceClass() == GateInstance.class) { if (reference.getEType().getInstanceClass() == GateInstance.class) {
if (context instanceof GateReference) { if (context instanceof GateReference) {
GateReference gate = (GateReference) context; GateReference gate = (GateReference) context;
...@@ -119,6 +122,36 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider { ...@@ -119,6 +122,36 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
return scope; 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) { } else if (reference.getEType().getInstanceClass() == Variable.class) {
if (context instanceof Assignment) { if (context instanceof Assignment) {
...@@ -142,6 +175,7 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider { ...@@ -142,6 +175,7 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
} else { } else {
} }
if (context instanceof Block) { if (context instanceof Block) {
TestDescription testDescription = getTestDescription((Element) context); TestDescription testDescription = getTestDescription((Element) context);
if (testDescription!=null) { if (testDescription!=null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment