Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TDL Open Source
TOP IDE
Commits
aa52bf35
Commit
aa52bf35
authored
Apr 27, 2020
by
Philip Makedonski
Browse files
+ updated scope resolution for inheritance
parent
8467a55d
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/org.etsi.mts.tdl.TDLan2/src/org/etsi/mts/tdl/scoping/TDLan2ScopeProvider.java
View file @
aa52bf35
...
...
@@ -24,12 +24,12 @@ import org.etsi.mts.tdl.DataInstanceUse;
import
org.etsi.mts.tdl.DataUse
;
import
org.etsi.mts.tdl.Element
;
import
org.etsi.mts.tdl.ElementImport
;
import
org.etsi.mts.tdl.Extension
;
import
org.etsi.mts.tdl.FormalParameterUse
;
import
org.etsi.mts.tdl.FunctionCall
;
import
org.etsi.mts.tdl.GateInstance
;
import
org.etsi.mts.tdl.GateReference
;
import
org.etsi.mts.tdl.LocalExpression
;
import
org.etsi.mts.tdl.Member
;
import
org.etsi.mts.tdl.MemberAssignment
;
import
org.etsi.mts.tdl.MemberReference
;
import
org.etsi.mts.tdl.Message
;
...
...
@@ -51,7 +51,6 @@ import org.etsi.mts.tdl.ValueAssignment;
import
org.etsi.mts.tdl.Variable
;
import
org.etsi.mts.tdl.VariableUse
;
import
org.etsi.mts.tdl.tdlPackage
;
import
org.etsi.mts.tdl.impl.ComponentInstanceBindingImpl
;
import
com.google.common.base.Function
;
import
com.google.inject.Inject
;
...
...
@@ -78,7 +77,7 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
if
(
context
instanceof
GateReference
)
{
GateReference
gate
=
(
GateReference
)
context
;
if
(
gate
.
getComponent
().
getType
()!=
null
)
{
IScope
scope
=
Scopes
.
scopeFor
(
gate
.
getComponent
().
getType
().
get
Gate
Instance
());
IScope
scope
=
Scopes
.
scopeFor
(
gate
.
getComponent
().
getType
().
all
Gate
s
());
return
scope
;
}
}
...
...
@@ -98,7 +97,7 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
}
else
if
(
context
instanceof
ComponentInstanceBinding
)
{
//assume actual
TestDescription
testDescription
=
getTestDescription
((
Element
)
context
);
if
(
reference
.
getFeatureID
()
==
tdlPackage
.
eINSTANCE
.
COMPONENT_INSTANCE_BINDING__FORMAL_COMPONENT
)
{
if
(
reference
.
getFeatureID
()
==
tdlPackage
.
COMPONENT_INSTANCE_BINDING__FORMAL_COMPONENT
)
{
testDescription
=
((
TestDescriptionReference
)
context
.
eContainer
()).
getTestDescription
();
}
TestConfiguration
configuration
=
testDescription
.
getTestConfiguration
();
...
...
@@ -139,7 +138,12 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
// elements.add(c.getEndPoint().get(0));
// }
}
else
if
(
context
instanceof
Target
)
{
GateReference
opposite
=
((
Message
)
context
.
eContainer
()).
getSourceGate
();
GateReference
opposite
=
null
;
if
(
context
.
eContainer
()
instanceof
Message
)
{
opposite
=
((
Message
)
context
.
eContainer
()).
getSourceGate
();
}
else
{
opposite
=
((
ProcedureCall
)
context
.
eContainer
()).
getSourceGate
();
}
if
(
c
.
getEndPoint
().
get
(
0
)
==
opposite
)
{
elements
.
add
(
c
.
getEndPoint
().
get
(
1
));
}
else
if
(
c
.
getEndPoint
().
get
(
1
)
==
opposite
)
{
...
...
@@ -167,13 +171,13 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
}
else
if
(
Parameter
.
class
.
isAssignableFrom
(
reference
.
getEType
().
getInstanceClass
()))
{
if
(
context
instanceof
MemberAssignment
)
{
if
(
context
.
eContainer
()
instanceof
StructuredDataInstance
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
StructuredDataInstance
)
context
.
eContainer
()).
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
StructuredDataInstance
)
context
.
eContainer
()).
getDataType
()).
all
Member
s
());
return
scope
;
}
}
else
if
(
context
instanceof
ParameterMapping
)
{
if
(
context
.
eContainer
()
instanceof
DataElementMapping
)
{
if
(((
DataElementMapping
)
context
.
eContainer
()).
getMappableDataElement
()
instanceof
StructuredDataType
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
DataElementMapping
)
context
.
eContainer
()).
getMappableDataElement
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
DataElementMapping
)
context
.
eContainer
()).
getMappableDataElement
()).
all
Member
s
());
return
scope
;
}
else
if
(((
DataElementMapping
)
context
.
eContainer
()).
getMappableDataElement
()
instanceof
Action
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
Action
)((
DataElementMapping
)
context
.
eContainer
()).
getMappableDataElement
()).
getFormalParameter
());
...
...
@@ -183,16 +187,16 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
}
else
if
(
context
instanceof
ParameterBinding
)
{
if
(
context
.
eContainer
()
instanceof
DataInstanceUse
)
{
if
(((
DataInstanceUse
)
context
.
eContainer
()).
getDataInstance
()
instanceof
StructuredDataInstance
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
StructuredDataInstance
)((
DataInstanceUse
)
context
.
eContainer
()).
getDataInstance
()).
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
StructuredDataInstance
)((
DataInstanceUse
)
context
.
eContainer
()).
getDataInstance
()).
getDataType
()).
all
Member
s
());
return
scope
;
}
else
if
(
context
.
eContainer
().
eContainer
()
instanceof
MemberAssignment
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
MemberAssignment
)
context
.
eContainer
().
eContainer
()).
getMember
().
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
MemberAssignment
)
context
.
eContainer
().
eContainer
()).
getMember
().
getDataType
()).
all
Member
s
());
return
scope
;
}
else
if
(((
DataInstanceUse
)
context
.
eContainer
()).
getDataType
()
instanceof
StructuredDataType
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
DataInstanceUse
)
context
.
eContainer
()).
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
DataInstanceUse
)
context
.
eContainer
()).
getDataType
()).
all
Member
s
());
return
scope
;
}
else
if
(
context
.
eContainer
().
eContainer
()
instanceof
ParameterBinding
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
ParameterBinding
)
context
.
eContainer
().
eContainer
()).
getParameter
().
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
ParameterBinding
)
context
.
eContainer
().
eContainer
()).
getParameter
().
getDataType
()).
all
Member
s
());
return
scope
;
}
}
else
if
(
context
.
eContainer
()
instanceof
FunctionCall
)
{
...
...
@@ -211,10 +215,10 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
return
scope
;
// }
}
else
if
(
context
.
eContainer
()
instanceof
FormalParameterUse
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
FormalParameterUse
)
context
.
eContainer
()).
getParameter
().
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
FormalParameterUse
)
context
.
eContainer
()).
getParameter
().
getDataType
()).
all
Member
s
());
return
scope
;
}
else
if
(
context
.
eContainer
()
instanceof
VariableUse
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
VariableUse
)
context
.
eContainer
()).
getVariable
().
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
VariableUse
)
context
.
eContainer
()).
getVariable
().
getDataType
()).
all
Member
s
());
return
scope
;
}
else
if
(
context
.
eContainer
()
instanceof
ProcedureCall
)
{
// if (((FunctionCall)context.eContainer()).getFunction().get instanceof StructuredDataInstance) {
...
...
@@ -227,29 +231,29 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
EObject
targetContext
=
((
DataUse
)
context
.
eContainer
()).
getReduction
().
get
(((
DataUse
)
context
.
eContainer
()).
getReduction
().
indexOf
(
context
)-
1
);
if
(((
MemberReference
)
targetContext
).
getMember
()!=
null
)
{
if
(((
MemberReference
)
targetContext
).
getMember
().
getDataType
()
instanceof
StructuredDataType
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
MemberReference
)
targetContext
).
getMember
().
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
MemberReference
)
targetContext
).
getMember
().
getDataType
()).
all
Member
s
());
return
scope
;
}
}
}
if
(
context
.
eContainer
()
instanceof
DataInstanceUse
)
{
if
(((
DataInstanceUse
)
context
.
eContainer
()).
getDataInstance
()
instanceof
StructuredDataInstance
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
StructuredDataInstance
)((
DataInstanceUse
)
context
.
eContainer
()).
getDataInstance
()).
getDataType
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
StructuredDataInstance
)((
DataInstanceUse
)
context
.
eContainer
()).
getDataInstance
()).
getDataType
()).
all
Member
s
());
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
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
FunctionCall
)
context
.
eContainer
()).
getFunction
().
getReturnType
()).
all
Member
s
());
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
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
FormalParameterUse
)
context
.
eContainer
()).
getParameter
().
getDataType
()).
all
Member
s
());
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
()).
get
Member
());
IScope
scope
=
Scopes
.
scopeFor
(((
StructuredDataType
)((
VariableUse
)
context
.
eContainer
()).
getVariable
().
getDataType
()).
all
Member
s
());
return
scope
;
}
}
else
{
...
...
@@ -258,25 +262,28 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
}
else
if
(
reference
.
getEType
().
getInstanceClass
()
==
Variable
.
class
)
{
if
(
context
instanceof
Assignment
)
{
if
(((
Assignment
)
context
).
getComponentInstance
()!=
null
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
Assignment
)
context
).
getComponentInstance
().
getType
().
get
Variable
());
IScope
scope
=
Scopes
.
scopeFor
(((
Assignment
)
context
).
getComponentInstance
().
getType
().
all
Variable
s
());
return
scope
;
}
}
if
(
context
instanceof
VariableUse
)
{
if
(((
VariableUse
)
context
).
getComponentInstance
()!=
null
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
VariableUse
)
context
).
getComponentInstance
().
getType
().
get
Variable
());
IScope
scope
=
Scopes
.
scopeFor
(((
VariableUse
)
context
).
getComponentInstance
().
getType
().
all
Variable
s
());
return
scope
;
}
}
else
if
(
context
instanceof
ValueAssignment
)
{
if
(((
Target
)
context
.
eContainer
()).
getTargetGate
().
getComponent
()!=
null
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
Target
)
context
.
eContainer
()).
getTargetGate
().
getComponent
().
getType
().
get
Variable
());
IScope
scope
=
Scopes
.
scopeFor
(((
Target
)
context
.
eContainer
()).
getTargetGate
().
getComponent
().
getType
().
all
Variable
s
());
return
scope
;
}
}
}
else
if
(
reference
.
getEType
().
getInstanceClass
()
==
Timer
.
class
)
{
IScope
scope
=
Scopes
.
scopeFor
(((
TimerOperation
)
context
).
getComponentInstance
().
getType
().
get
Timer
());
IScope
scope
=
Scopes
.
scopeFor
(((
TimerOperation
)
context
).
getComponentInstance
().
getType
().
all
Timer
s
());
return
scope
;
}
else
if
(
context
instanceof
Extension
)
{
EList
<
EObject
>
elements
=
getScopedElementsOfType
(
context
,
((
Element
)
context
.
eContainer
()).
getClass
());
return
Scopes
.
scopeFor
(
elements
);
}
else
{
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment