Currently, there are three cases in which elements are still being physically added to the parse tree (rather than cached in adapters like is done for implicit relationships), when they are not declared explicitly in a model: result parameters for expressions, subject parameters for requirements and cases and objectives for cases. This is not actually called for in the specifications, but is still necessary in order for implied redefinitions to be added correctly in the case of multiple specializations.
For example, in the following model:
analysis def A {
subject s;
objective o;
return r;
}
part context {
part p {
s = a.s;
o = a.o;
r = a.r;
}
analysis a : A {
// subject added that redefines s.
// objective added that redefines o.
// return parameter added that redefines r.
}
}
subject, objective and result features are added to the parse tree for the analysis case usage a. These features implicitly redefine the corresponding features s, o and r from the analysis case definition A. Because of these redefinitions, the references to s, o and r within part usage p should resolve to the features of the usage a.
This PR fixes a bug that could result in these references incorrectly resolving to the features of the definition A when the declaration of a is lexically after the declaration of p. It also moves utility methods related to subjects and objectives out of class TypeUtil into the SysML-specific class UsageUtil.
Currently, there are three cases in which elements are still being physically added to the parse tree (rather than cached in adapters like is done for implicit relationships), when they are not declared explicitly in a model: result parameters for expressions, subject parameters for requirements and cases and objectives for cases. This is not actually called for in the specifications, but is still necessary in order for implied redefinitions to be added correctly in the case of multiple specializations.
For example, in the following model:
subject, objective and result features are added to the parse tree for the analysis case usage
a
. These features implicitly redefine the corresponding featuress
,o
andr
from the analysis case definitionA
. Because of these redefinitions, the references tos
,o
andr
within part usagep
should resolve to the features of the usagea
.This PR fixes a bug that could result in these references incorrectly resolving to the features of the definition
A
when the declaration ofa
is lexically after the declaration ofp
. It also moves utility methods related to subjects and objectives out of classTypeUtil
into the SysML-specific classUsageUtil
.