diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/Module.java b/src/main/java/io/proleap/vb6/asg/metamodel/Module.java index eddef91..f3e6a29 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/Module.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/Module.java @@ -89,19 +89,31 @@ public enum OptionCompare { Function getFunction(String name); + List getFunctions(); + List getLines(); + List getProcedures(); + @Override Program getProgram(); PropertyGet getPropertyGet(String name); + List getPropertyGets(); + PropertyLet getPropertyLet(String name); + List getPropertyLets(); + PropertySet getPropertySet(String name); + List getPropertySets(); + Sub getSub(String name); + List getSubs(); + io.proleap.vb6.asg.metamodel.Type getType(String name); Double getVersion(); diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/Procedure.java b/src/main/java/io/proleap/vb6/asg/metamodel/Procedure.java index 9141d59..24076e9 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/Procedure.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/Procedure.java @@ -14,9 +14,10 @@ import io.proleap.vb6.VisualBasic6Parser.ArgContext; import io.proleap.vb6.VisualBasic6Parser.ArgDefaultValueContext; import io.proleap.vb6.asg.metamodel.call.Call; +import io.proleap.vb6.asg.metamodel.statement.Statement; import io.proleap.vb6.asg.metamodel.type.Type; -public interface Procedure extends Scope, Declaration, VisibilityElement { +public interface Procedure extends Scope, Declaration, Statement, VisibilityElement { Arg addArg(ArgContext ctx); diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/impl/ModuleImpl.java b/src/main/java/io/proleap/vb6/asg/metamodel/impl/ModuleImpl.java index 5d01e15..6be01c4 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/impl/ModuleImpl.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/impl/ModuleImpl.java @@ -13,6 +13,8 @@ import java.util.List; import java.util.Map; +import com.google.common.collect.Lists; + import io.proleap.vb6.VisualBasic6Parser.ArgContext; import io.proleap.vb6.VisualBasic6Parser.AttributeStmtContext; import io.proleap.vb6.VisualBasic6Parser.DeclareStmtContext; @@ -38,6 +40,7 @@ import io.proleap.vb6.asg.metamodel.Literal; import io.proleap.vb6.asg.metamodel.Module; import io.proleap.vb6.asg.metamodel.ModuleConfigElement; +import io.proleap.vb6.asg.metamodel.Procedure; import io.proleap.vb6.asg.metamodel.ProcedureDeclaration; import io.proleap.vb6.asg.metamodel.Program; import io.proleap.vb6.asg.metamodel.ScopedElement; @@ -90,6 +93,8 @@ public abstract class ModuleImpl extends ScopeImpl implements Module { protected Boolean optionPrivateModule; + protected List procedures = new ArrayList(); + protected final Program program; protected Map propertyGets = new HashMap(); @@ -244,6 +249,7 @@ public Function addFunction(final FunctionStmtContext ctx) { registerStatement(result); functions.put(name, result); + procedures.add(result); if (ctx.argList() != null) { for (final ArgContext argCtx : ctx.argList().arg()) { @@ -334,6 +340,7 @@ public PropertyGet addPropertyGet(final PropertyGetStmtContext ctx) { registerStatement(result); propertyGets.put(name, result); + procedures.add(result); if (ctx.argList() != null) { for (final ArgContext argCtx : ctx.argList().arg()) { @@ -369,6 +376,7 @@ public PropertyLet addPropertyLet(final PropertyLetStmtContext ctx) { registerStatement(result); propertyLets.put(name, result); + procedures.add(result); if (ctx.argList() != null) { for (final ArgContext argCtx : ctx.argList().arg()) { @@ -392,6 +400,7 @@ public PropertySet addPropertySet(final PropertySetStmtContext ctx) { registerStatement(result); propertySets.put(name, result); + procedures.add(result); if (ctx.argList() != null) { for (final ArgContext argCtx : ctx.argList().arg()) { @@ -415,6 +424,7 @@ public Sub addSub(final SubStmtContext ctx) { registerStatement(result); subs.put(name, result); + procedures.add(result); if (ctx.argList() != null) { for (final ArgContext argCtx : ctx.argList().arg()) { @@ -502,6 +512,11 @@ public Function getFunction(final String name) { return functions.get(name); } + @Override + public List getFunctions() { + return Lists.newArrayList(functions.values()); + } + @Override public List getLines() { return lines; @@ -512,6 +527,11 @@ public String getName() { return name; } + @Override + public List getProcedures() { + return procedures; + } + @Override public Program getProgram() { return program; @@ -522,16 +542,31 @@ public PropertyGet getPropertyGet(final String name) { return propertyGets.get(name); } + @Override + public List getPropertyGets() { + return Lists.newArrayList(propertyGets.values()); + } + @Override public PropertyLet getPropertyLet(final String name) { return propertyLets.get(name); } + @Override + public List getPropertyLets() { + return Lists.newArrayList(propertyLets.values()); + } + @Override public PropertySet getPropertySet(final String name) { return propertySets.get(name); } + @Override + public List getPropertySets() { + return Lists.newArrayList(propertySets.values()); + } + @Override public List getScopedElementsInScope(final String name) { final List result; @@ -553,6 +588,11 @@ public Sub getSub(final String name) { return subs.get(name); } + @Override + public List getSubs() { + return Lists.newArrayList(subs.values()); + } + @Override public io.proleap.vb6.asg.metamodel.Type getType(final String name) { return types.get(name); diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/statement/function/Function.java b/src/main/java/io/proleap/vb6/asg/metamodel/statement/function/Function.java index fbe8e70..a440ac9 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/statement/function/Function.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/statement/function/Function.java @@ -13,14 +13,13 @@ import io.proleap.vb6.VisualBasic6Parser.FunctionStmtContext; import io.proleap.vb6.asg.metamodel.Procedure; import io.proleap.vb6.asg.metamodel.call.FunctionCall; -import io.proleap.vb6.asg.metamodel.statement.Statement; import io.proleap.vb6.asg.metamodel.type.AssignableTypedElement; /** * Declares the name, arguments, and code that form the body of a Function * procedure. */ -public interface Function extends Procedure, Statement, AssignableTypedElement { +public interface Function extends Procedure, AssignableTypedElement { void addFunctionCall(FunctionCall functionCall); diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/get/PropertyGet.java b/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/get/PropertyGet.java index 231e870..7e9e168 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/get/PropertyGet.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/get/PropertyGet.java @@ -13,14 +13,13 @@ import io.proleap.vb6.VisualBasic6Parser.PropertyGetStmtContext; import io.proleap.vb6.asg.metamodel.Procedure; import io.proleap.vb6.asg.metamodel.call.PropertyGetCall; -import io.proleap.vb6.asg.metamodel.statement.Statement; import io.proleap.vb6.asg.metamodel.type.AssignableTypedElement; /** * Declares the name, arguments, and code that form the body of a Property * procedure, which gets the value of a property. */ -public interface PropertyGet extends Procedure, Statement, AssignableTypedElement { +public interface PropertyGet extends Procedure, AssignableTypedElement { void addPropertyGetCall(PropertyGetCall propertyGetCall); diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/let/PropertyLet.java b/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/let/PropertyLet.java index 4cb7edf..73ed79c 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/let/PropertyLet.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/let/PropertyLet.java @@ -13,13 +13,12 @@ import io.proleap.vb6.VisualBasic6Parser.PropertyLetStmtContext; import io.proleap.vb6.asg.metamodel.Procedure; import io.proleap.vb6.asg.metamodel.call.PropertyLetCall; -import io.proleap.vb6.asg.metamodel.statement.Statement; /** * Declares the name, arguments, and code that form the body of a Property Let * procedure, which assigns a value to a property. */ -public interface PropertyLet extends Procedure, Statement { +public interface PropertyLet extends Procedure { void addPropertyLetCall(PropertyLetCall propertyLetCall); diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/set/PropertySet.java b/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/set/PropertySet.java index 49b842d..0436ce3 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/set/PropertySet.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/statement/property/set/PropertySet.java @@ -13,13 +13,12 @@ import io.proleap.vb6.VisualBasic6Parser.PropertySetStmtContext; import io.proleap.vb6.asg.metamodel.Procedure; import io.proleap.vb6.asg.metamodel.call.PropertySetCall; -import io.proleap.vb6.asg.metamodel.statement.Statement; /** * Declares the name, arguments, and code that form the body of a Property * procedure, which sets a reference to an object. */ -public interface PropertySet extends Procedure, Statement { +public interface PropertySet extends Procedure { void addPropertySetCall(PropertySetCall propertySetCall); diff --git a/src/main/java/io/proleap/vb6/asg/metamodel/statement/sub/Sub.java b/src/main/java/io/proleap/vb6/asg/metamodel/statement/sub/Sub.java index d73c2c3..40bf344 100755 --- a/src/main/java/io/proleap/vb6/asg/metamodel/statement/sub/Sub.java +++ b/src/main/java/io/proleap/vb6/asg/metamodel/statement/sub/Sub.java @@ -13,12 +13,11 @@ import io.proleap.vb6.VisualBasic6Parser.SubStmtContext; import io.proleap.vb6.asg.metamodel.Procedure; import io.proleap.vb6.asg.metamodel.call.SubCall; -import io.proleap.vb6.asg.metamodel.statement.Statement; /** * Declares the name, arguments, and code that form the body of a Sub procedure. */ -public interface Sub extends Procedure, Statement { +public interface Sub extends Procedure { void addSubCall(SubCall subCall);