Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +16 −6 Original line number Diff line number Diff line Loading @@ -8,6 +8,9 @@ import de.ugoe.cs.swe.tTCN3.ComponentDefList import de.ugoe.cs.swe.tTCN3.ConstDef import de.ugoe.cs.swe.tTCN3.ConstList import de.ugoe.cs.swe.tTCN3.ControlStatementOrDefList import de.ugoe.cs.swe.tTCN3.EnumDefNamed import de.ugoe.cs.swe.tTCN3.Enumeration import de.ugoe.cs.swe.tTCN3.EnumerationList import de.ugoe.cs.swe.tTCN3.FunctionDefList import de.ugoe.cs.swe.tTCN3.FunctionFormalPar import de.ugoe.cs.swe.tTCN3.FunctionFormalParList Loading Loading @@ -39,6 +42,7 @@ import de.ugoe.cs.swe.tTCN3.TypeDef import de.ugoe.cs.swe.tTCN3.VarList import java.util.ArrayList import org.eclipse.emf.ecore.EObject import de.ugoe.cs.swe.tTCN3.EnumDef class TTCN3ScopeHelper { Loading Loading @@ -78,13 +82,13 @@ class TTCN3ScopeHelper { defs = moduleDef.definitions.filter[it.def instanceof TypeDef] for (ModuleDefinition v : defs) { val body = (v.def as TypeDef).body if (body.structured != null && body.structured.recordOf != null && body.structured.recordOf instanceof RecordOfDefNamed) { list.add(body.structured.recordOf) if (body.structured != null && body.structured.enumDef != null && body.structured.enumDef instanceof EnumDefNamed) { (body.structured.enumDef as EnumDefNamed).list.scopeEnumElements(list) } if (body.structured != null && body.structured.setOf != null && body.structured.setOf instanceof SetOfDefNamed) { list.add(body.structured.setOf) if (body.structured != null && body.structured.enumDef != null && body.structured.enumDef instanceof EnumDef) { (body.structured.enumDef as EnumDef).list.scopeEnumElements(list) } } Loading @@ -104,6 +108,12 @@ class TTCN3ScopeHelper { } } def static void scopeEnumElements(EnumerationList eList, ArrayList<EObject> list) { for (Enumeration e : eList.enums) { list.add(e); } } def static void scopeStatementBlock(StatementBlock block, ArrayList<EObject> list) { for (FunctionDefList l : block.def.filter[it != null]) { if (l.locDef != null && l.locDef.constDef != null) { Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +9 −1 Original line number Diff line number Diff line Loading @@ -48,11 +48,13 @@ import static org.eclipse.xtext.scoping.Scopes.* import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.* import de.ugoe.cs.swe.tTCN3.BaseTemplate import de.ugoe.cs.swe.tTCN3.SubTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDefNamed class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { /** * This solution do not compare the defined variable with the assigned variable. * This solution does not compare the defined variable with the assigned variable. * * To compare the assigned with the defined value, something like this: * "def IScope scope_RefValue(RefValue variable, EReference ref)" Loading Loading @@ -107,9 +109,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { val module = type.findDesiredParent(typeof(ModuleDefinitionsList)) as TTCN3Module val res = newArrayList var StructuredTypeDef struct = null; var SubTypeDef sub = null; for (ModuleDefinition d : module.defs.definitions.filter[it.def instanceof TypeDef]) { struct = (d.def as TypeDef).body.structured sub = (d.def as TypeDef).body.sub if (struct != null) { if (struct.record != null && struct.record instanceof RecordDefNamed) { Loading @@ -129,6 +133,10 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { } else if (struct.component != null) { res.add(struct.component) } } else if (sub != null) { if (sub instanceof SubTypeDefNamed) { res.add(sub) } } } Loading Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +16 −6 Original line number Diff line number Diff line Loading @@ -8,6 +8,9 @@ import de.ugoe.cs.swe.tTCN3.ComponentDefList import de.ugoe.cs.swe.tTCN3.ConstDef import de.ugoe.cs.swe.tTCN3.ConstList import de.ugoe.cs.swe.tTCN3.ControlStatementOrDefList import de.ugoe.cs.swe.tTCN3.EnumDefNamed import de.ugoe.cs.swe.tTCN3.Enumeration import de.ugoe.cs.swe.tTCN3.EnumerationList import de.ugoe.cs.swe.tTCN3.FunctionDefList import de.ugoe.cs.swe.tTCN3.FunctionFormalPar import de.ugoe.cs.swe.tTCN3.FunctionFormalParList Loading Loading @@ -39,6 +42,7 @@ import de.ugoe.cs.swe.tTCN3.TypeDef import de.ugoe.cs.swe.tTCN3.VarList import java.util.ArrayList import org.eclipse.emf.ecore.EObject import de.ugoe.cs.swe.tTCN3.EnumDef class TTCN3ScopeHelper { Loading Loading @@ -78,13 +82,13 @@ class TTCN3ScopeHelper { defs = moduleDef.definitions.filter[it.def instanceof TypeDef] for (ModuleDefinition v : defs) { val body = (v.def as TypeDef).body if (body.structured != null && body.structured.recordOf != null && body.structured.recordOf instanceof RecordOfDefNamed) { list.add(body.structured.recordOf) if (body.structured != null && body.structured.enumDef != null && body.structured.enumDef instanceof EnumDefNamed) { (body.structured.enumDef as EnumDefNamed).list.scopeEnumElements(list) } if (body.structured != null && body.structured.setOf != null && body.structured.setOf instanceof SetOfDefNamed) { list.add(body.structured.setOf) if (body.structured != null && body.structured.enumDef != null && body.structured.enumDef instanceof EnumDef) { (body.structured.enumDef as EnumDef).list.scopeEnumElements(list) } } Loading @@ -104,6 +108,12 @@ class TTCN3ScopeHelper { } } def static void scopeEnumElements(EnumerationList eList, ArrayList<EObject> list) { for (Enumeration e : eList.enums) { list.add(e); } } def static void scopeStatementBlock(StatementBlock block, ArrayList<EObject> list) { for (FunctionDefList l : block.def.filter[it != null]) { if (l.locDef != null && l.locDef.constDef != null) { Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +9 −1 Original line number Diff line number Diff line Loading @@ -48,11 +48,13 @@ import static org.eclipse.xtext.scoping.Scopes.* import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.* import de.ugoe.cs.swe.tTCN3.BaseTemplate import de.ugoe.cs.swe.tTCN3.SubTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDefNamed class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { /** * This solution do not compare the defined variable with the assigned variable. * This solution does not compare the defined variable with the assigned variable. * * To compare the assigned with the defined value, something like this: * "def IScope scope_RefValue(RefValue variable, EReference ref)" Loading Loading @@ -107,9 +109,11 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { val module = type.findDesiredParent(typeof(ModuleDefinitionsList)) as TTCN3Module val res = newArrayList var StructuredTypeDef struct = null; var SubTypeDef sub = null; for (ModuleDefinition d : module.defs.definitions.filter[it.def instanceof TypeDef]) { struct = (d.def as TypeDef).body.structured sub = (d.def as TypeDef).body.sub if (struct != null) { if (struct.record != null && struct.record instanceof RecordDefNamed) { Loading @@ -129,6 +133,10 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { } else if (struct.component != null) { res.add(struct.component) } } else if (sub != null) { if (sub instanceof SubTypeDefNamed) { res.add(sub) } } } Loading