Skip to content
Merged
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
3 changes: 3 additions & 0 deletions mdl/visitor/visitor_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ func parseAnnotationParamInt(ctx parser.IAnnotationParamContext) int {
}
paramCtx := ctx.(*parser.AnnotationParamContext)
if valueCtx := paramCtx.AnnotationValue(); valueCtx != nil {
if val, err := strconv.Atoi(strings.TrimSpace(valueCtx.GetText())); err == nil {
return val
}
annValue := valueCtx.(*parser.AnnotationValueContext)
if lit := annValue.Literal(); lit != nil {
litCtx := lit.(*parser.LiteralContext)
Expand Down
25 changes: 25 additions & 0 deletions mdl/visitor/visitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1804,6 +1804,31 @@ END;`
}
}

func TestMicroflowPositionAnnotationAcceptsNegativeCoordinates(t *testing.T) {
input := `CREATE MICROFLOW Synthetic.Check ()
BEGIN
@position(-150, -210)
LOG INFO NODE 'SyntheticLog' 'message';
END;`

prog, errs := Build(input)
if len(errs) > 0 {
t.Fatalf("unexpected parse errors: %v", errs)
}

stmt := prog.Statements[0].(*ast.CreateMicroflowStmt)
logStmt, ok := stmt.Body[0].(*ast.LogStmt)
if !ok {
t.Fatalf("Expected LogStmt, got %T", stmt.Body[0])
}
if logStmt.Annotations == nil || logStmt.Annotations.Position == nil {
t.Fatal("expected position annotation")
}
if got := *logStmt.Annotations.Position; got.X != -150 || got.Y != -210 {
t.Fatalf("position = (%d, %d), want (-150, -210)", got.X, got.Y)
}
}

func TestCallJavaActionAcceptsEmptyArguments(t *testing.T) {
input := `CREATE MICROFLOW Synthetic.Check ()
RETURNS Boolean AS $Success
Expand Down
Loading