Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ assertj_version = 3.21.0
junit_version = 5.8.2

# Version of published artifacts
version = 7.8.78
version = 7.8.79
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ component grammar SysMLExpressions
"{" SysMLElement* inner:Expression "}" ;

SysMLFunctionOperationExpression implements Expression <291> =
Expression "->" Name
Expression "->" MCQualifiedName
("(" (SysMLParameter || ",")* ")")?
(body:SysMLBodyExpression)? ;

Expand Down
26 changes: 25 additions & 1 deletion language/src/test/java/parser/ExpressionParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,31 @@ public void testFunctionOperationAfterFieldAccess() throws IOException {
var functionOperation = (ASTSysMLFunctionOperationExpression) ast.get();
assertThat(functionOperation.getExpression())
.isInstanceOf(ASTFieldAccessExpression.class);
assertThat(functionOperation.getName()).isEqualTo("c");
assertThat(functionOperation.getMCQualifiedName().getPartsList()).containsExactly("c");
}

/**
* Checks that qualified names on both sides of a function operation
* are parsed with the correct binding.
*/
@ParameterizedTest
@ValueSource(strings = {
"a.b->c.d",
"a::b->c::d",
"a::b->c.d",
"a.b->c::d"
})
public void testQualifiedNamesInFunctionOperation(String expr) throws IOException {
var ast = parser.parse_StringExpression(expr);

assertThat(ast).isPresent();
assertThat(Log.getFindings()).isEmpty();
assertThat(ast.get()).isInstanceOf(ASTSysMLFunctionOperationExpression.class);

var functionOperation = (ASTSysMLFunctionOperationExpression) ast.get();
assertThat(functionOperation.getExpression())
.isInstanceOf(ASTFieldAccessExpression.class);
assertThat(functionOperation.getMCQualifiedName().getPartsList())
.containsExactly("c", "d");
}
}
Loading