Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +52 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,12 @@ import de.ugoe.cs.swe.tTCN3.VarList import java.util.ArrayList import org.eclipse.emf.ecore.EObject import de.ugoe.cs.swe.tTCN3.EnumDef import de.ugoe.cs.swe.tTCN3.TTCN3Module import de.ugoe.cs.swe.tTCN3.GroupDef import de.ugoe.cs.swe.tTCN3.StructuredTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDef import de.ugoe.cs.swe.tTCN3.UnionDefNamed import de.ugoe.cs.swe.tTCN3.SubTypeDefNamed class TTCN3ScopeHelper { Loading @@ -69,6 +75,52 @@ class TTCN3ScopeHelper { } } // TODO: test me! def static void scopeModuleVariable(TTCN3Module module, ArrayList<EObject> list) { if (module.defs != null) { module.defs.scopeModuleVariable(list) for (ModuleDefinition g : module.defs.definitions.filter[it.def instanceof GroupDef]) { val GroupDef group = g.def as GroupDef group.list.scopeModuleVariable(list) } } } def static void scopeModuleTypes(ModuleDefinitionsList moduleDefs, ReferencedType type, ArrayList<EObject> res) { var StructuredTypeDef struct = null; var SubTypeDef sub = null; for (ModuleDefinition d : moduleDefs.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) { res.add(struct.record) } else if (struct.union != null && struct.union instanceof UnionDefNamed) { res.add(struct.union) } else if (struct.set != null && struct.set instanceof SetDefNamed) { res.add(struct.set) } else if (struct.recordOf != null && struct.recordOf instanceof RecordOfDefNamed) { res.add(struct.recordOf) } else if (struct.setOf != null && struct.setOf instanceof SetOfDefNamed) { res.add(struct.setOf) } else if (struct.enumDef != null && struct.enumDef instanceof EnumDefNamed) { res.add(struct.enumDef) } else if (struct.port != null) { res.add(struct.port) } else if (struct.component != null) { res.add(struct.component) } } else if (sub != null) { if (sub instanceof SubTypeDefNamed) { res.add(sub) } } } } def static void scopeModuleVariable(ModuleDefinitionsList moduleDef, ArrayList<EObject> list) { var defs = moduleDef.definitions.filter[it.def instanceof ConstDef] Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +8 −28 Original line number Diff line number Diff line Loading @@ -105,40 +105,20 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { scopeFor(list) } //TODO: fix me!!! def IScope scope_ReferencedType(ReferencedType type, EReference ref) { val module = type.findDesiredParent(typeof(ModuleDefinitionsList)) as TTCN3Module val module = type.findDesiredParent(typeof(TTCN3Module)) 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 (module.defs != null) { module.defs.scopeModuleTypes(type, res) if (struct != null) { if (struct.record != null && struct.record instanceof RecordDefNamed) { res.add(struct.record) } else if (struct.union != null && struct.union instanceof UnionDefNamed) { res.add(struct.union) } else if (struct.set != null && struct.set instanceof SetDefNamed) { res.add(struct.set) } else if (struct.recordOf != null && struct.recordOf instanceof RecordOfDefNamed) { res.add(struct.recordOf) } else if (struct.setOf != null && struct.setOf instanceof SetOfDefNamed) { res.add(struct.setOf) } else if (struct.enumDef != null && struct.enumDef instanceof EnumDefNamed) { res.add(struct.enumDef) } else if (struct.port != null) { res.add(struct.port) } else if (struct.component != null) { res.add(struct.component) } } else if (sub != null) { if (sub instanceof SubTypeDefNamed) { res.add(sub) for (ModuleDefinition g : module.defs.definitions.filter[it.def instanceof GroupDef]) { val GroupDef group = g.def as GroupDef if (group.list != null) { group.list.scopeModuleTypes(type, res) } } } scopeFor(res) } Loading Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ScopeHelper.xtend +52 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,12 @@ import de.ugoe.cs.swe.tTCN3.VarList import java.util.ArrayList import org.eclipse.emf.ecore.EObject import de.ugoe.cs.swe.tTCN3.EnumDef import de.ugoe.cs.swe.tTCN3.TTCN3Module import de.ugoe.cs.swe.tTCN3.GroupDef import de.ugoe.cs.swe.tTCN3.StructuredTypeDef import de.ugoe.cs.swe.tTCN3.SubTypeDef import de.ugoe.cs.swe.tTCN3.UnionDefNamed import de.ugoe.cs.swe.tTCN3.SubTypeDefNamed class TTCN3ScopeHelper { Loading @@ -69,6 +75,52 @@ class TTCN3ScopeHelper { } } // TODO: test me! def static void scopeModuleVariable(TTCN3Module module, ArrayList<EObject> list) { if (module.defs != null) { module.defs.scopeModuleVariable(list) for (ModuleDefinition g : module.defs.definitions.filter[it.def instanceof GroupDef]) { val GroupDef group = g.def as GroupDef group.list.scopeModuleVariable(list) } } } def static void scopeModuleTypes(ModuleDefinitionsList moduleDefs, ReferencedType type, ArrayList<EObject> res) { var StructuredTypeDef struct = null; var SubTypeDef sub = null; for (ModuleDefinition d : moduleDefs.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) { res.add(struct.record) } else if (struct.union != null && struct.union instanceof UnionDefNamed) { res.add(struct.union) } else if (struct.set != null && struct.set instanceof SetDefNamed) { res.add(struct.set) } else if (struct.recordOf != null && struct.recordOf instanceof RecordOfDefNamed) { res.add(struct.recordOf) } else if (struct.setOf != null && struct.setOf instanceof SetOfDefNamed) { res.add(struct.setOf) } else if (struct.enumDef != null && struct.enumDef instanceof EnumDefNamed) { res.add(struct.enumDef) } else if (struct.port != null) { res.add(struct.port) } else if (struct.component != null) { res.add(struct.component) } } else if (sub != null) { if (sub instanceof SubTypeDefNamed) { res.add(sub) } } } } def static void scopeModuleVariable(ModuleDefinitionsList moduleDef, ArrayList<EObject> list) { var defs = moduleDef.definitions.filter[it.def instanceof ConstDef] Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/scoping/TTCN3ScopeProvider.xtend +8 −28 Original line number Diff line number Diff line Loading @@ -105,40 +105,20 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider { scopeFor(list) } //TODO: fix me!!! def IScope scope_ReferencedType(ReferencedType type, EReference ref) { val module = type.findDesiredParent(typeof(ModuleDefinitionsList)) as TTCN3Module val module = type.findDesiredParent(typeof(TTCN3Module)) 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 (module.defs != null) { module.defs.scopeModuleTypes(type, res) if (struct != null) { if (struct.record != null && struct.record instanceof RecordDefNamed) { res.add(struct.record) } else if (struct.union != null && struct.union instanceof UnionDefNamed) { res.add(struct.union) } else if (struct.set != null && struct.set instanceof SetDefNamed) { res.add(struct.set) } else if (struct.recordOf != null && struct.recordOf instanceof RecordOfDefNamed) { res.add(struct.recordOf) } else if (struct.setOf != null && struct.setOf instanceof SetOfDefNamed) { res.add(struct.setOf) } else if (struct.enumDef != null && struct.enumDef instanceof EnumDefNamed) { res.add(struct.enumDef) } else if (struct.port != null) { res.add(struct.port) } else if (struct.component != null) { res.add(struct.component) } } else if (sub != null) { if (sub instanceof SubTypeDefNamed) { res.add(sub) for (ModuleDefinition g : module.defs.definitions.filter[it.def instanceof GroupDef]) { val GroupDef group = g.def as GroupDef if (group.list != null) { group.list.scopeModuleTypes(type, res) } } } scopeFor(res) } Loading