Skip to content

Commit f244a0b

Browse files
committed
ST6RI-979 Added post-processing for feature-ref & instantiation exprs.
Moved result-adding code from conditional in ExpressionParserPostProcessor to new post-processor classes.
1 parent f2f137d commit f244a0b

6 files changed

Lines changed: 78 additions & 14 deletions

File tree

‎org.omg.kerml.xtext/src/org/omg/kerml/xtext/postprocessing/ExpressionParserPostProcessor.java‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111

1212
package org.omg.kerml.xtext.postprocessing;
1313

14-
import org.omg.sysml.lang.sysml.ConstructorExpression;
1514
import org.omg.sysml.lang.sysml.Expression;
16-
import org.omg.sysml.lang.sysml.FeatureReferenceExpression;
17-
import org.omg.sysml.lang.sysml.InvocationExpression;
18-
import org.omg.sysml.util.TypeUtil;
1915

2016
public class ExpressionParserPostProcessor extends StepParserPostProcessor {
2117

@@ -28,14 +24,4 @@ public Expression getTarget() {
2824
return (Expression)super.getTarget();
2925
}
3026

31-
@Override
32-
public void postProcess() {
33-
super.postProcess();
34-
Expression target = getTarget();
35-
if (target instanceof FeatureReferenceExpression || target instanceof ConstructorExpression
36-
|| target instanceof InvocationExpression) {
37-
TypeUtil.addResultParameterTo(target);
38-
}
39-
}
40-
4127
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*******************************************************************************
2+
* SysML 2 Pilot Implementation
3+
* Copyright (c) 2026 Model Driven Solutions, Inc.
4+
*
5+
* This program and the accompanying materials are made available under the
6+
* terms of the Eclipse Public License 2.0 which is available at
7+
* http://www.eclipse.org/legal/epl-2.0.
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*******************************************************************************/
11+
12+
package org.omg.kerml.xtext.postprocessing;
13+
14+
import org.omg.sysml.lang.sysml.FeatureReferenceExpression;
15+
import org.omg.sysml.util.TypeUtil;
16+
17+
public class FeatureReferenceExpressionParserPostProcessor extends ExpressionParserPostProcessor {
18+
19+
public FeatureReferenceExpressionParserPostProcessor(FeatureReferenceExpression element) {
20+
super(element);
21+
}
22+
23+
@Override
24+
public FeatureReferenceExpression getTarget() {
25+
return (FeatureReferenceExpression)super.getTarget();
26+
}
27+
28+
@Override
29+
public void postProcess() {
30+
super.postProcess();
31+
TypeUtil.addResultParameterTo(getTarget());
32+
}
33+
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*******************************************************************************
2+
* SysML 2 Pilot Implementation
3+
* Copyright (c) 2026 Model Driven Solutions, Inc.
4+
*
5+
* This program and the accompanying materials are made available under the
6+
* terms of the Eclipse Public License 2.0 which is available at
7+
* http://www.eclipse.org/legal/epl-2.0.
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*******************************************************************************/
11+
12+
package org.omg.kerml.xtext.postprocessing;
13+
14+
import org.omg.sysml.lang.sysml.InstantiationExpression;
15+
import org.omg.sysml.util.TypeUtil;
16+
17+
public class InstantiationExpressionParserPostProcessor extends ExpressionParserPostProcessor {
18+
19+
public InstantiationExpressionParserPostProcessor(InstantiationExpression element) {
20+
super(element);
21+
}
22+
23+
@Override
24+
public InstantiationExpression getTarget() {
25+
return (InstantiationExpression)super.getTarget();
26+
}
27+
28+
@Override
29+
public void postProcess() {
30+
super.postProcess();
31+
TypeUtil.addResultParameterTo(getTarget());
32+
}
33+
34+
}

‎org.omg.kerml.xtext/src/org/omg/kerml/xtext/postprocessing/KerMLParserPostProcessorFactory.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,21 @@ public ElementParserPostProcessor caseFeatureInverting(FeatureInverting element)
9898
return new FeatureInvertingParserPostProcessor(element);
9999
}
100100

101+
@Override
102+
public ElementParserPostProcessor caseFeatureReferenceExpression(FeatureReferenceExpression element) {
103+
return new FeatureReferenceExpressionParserPostProcessor(element);
104+
}
105+
101106
@Override
102107
public ElementParserPostProcessor caseFeatureTyping(FeatureTyping element) {
103108
return new FeatureTypingParserPostProcessor(element);
104109
}
105110

111+
@Override
112+
public ElementParserPostProcessor caseInstantiationExpression(InstantiationExpression element) {
113+
return new InstantiationExpressionParserPostProcessor(element);
114+
}
115+
106116
@Override
107117
public ElementParserPostProcessor caseImport(Import element) {
108118
return new ImportParserPostProcessor(element);
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)