Commit 7902f73f authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ safety checks for scoping

parent 1f6a1996
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import org.etsi.mts.tdl.ComponentInstance;
import org.etsi.mts.tdl.ComponentInstanceBinding;
import org.etsi.mts.tdl.Connection;
import org.etsi.mts.tdl.DataElementMapping;
import org.etsi.mts.tdl.DataInstance;
import org.etsi.mts.tdl.DataInstanceUse;
import org.etsi.mts.tdl.DataType;
import org.etsi.mts.tdl.DataUse;
@@ -298,9 +299,12 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider {
				} 
				if (context.eContainer() instanceof DataInstanceUse) {
					if (((DataInstanceUse)context.eContainer()).getDataInstance() instanceof StructuredDataInstance) {
						IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance)((DataInstanceUse)context.eContainer()).getDataInstance()).getDataType()).allMembers());
						DataInstance dataInstance = ((DataInstanceUse)context.eContainer()).getDataInstance();
						if (dataInstance instanceof StructuredDataInstance && dataInstance.getDataType() instanceof StructuredDataType) {
							IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance)dataInstance).getDataType()).allMembers());
							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()).allMembers());