Skip to content

Commit

Permalink
🧪 Handle precedence for call expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
ChmielewskiKamil committed Sep 7, 2024
1 parent a23b0fe commit 542749a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion parser/exprparsing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,16 @@ func Test_ParseOperatorPrecedence(t *testing.T) {
3 < 8 == true;
3 * (8 + 2) * 2;
10 / (1 + 1);
a + foo(b + c);
foo(a * b, c / d + e)
foo(a * b) + bar(c / d, e);
}`

file := test_helper_parseSource(t, src, false)

fnBody := test_helper_parseFnBody(t, file)

if len(fnBody.Statements) != 20 {
if len(fnBody.Statements) != 23 {
t.Fatalf("Expected 20 statements, got %d", len(fnBody.Statements))
}

Expand All @@ -259,6 +262,9 @@ func Test_ParseOperatorPrecedence(t *testing.T) {
{"((3 < 8) == true)"},
{"((3 * (8 + 2)) * 2)"},
{"(10 / (1 + 1))"},
{"(a + foo((b + c)))"},
{"foo((a * b), ((c / d) + e))"},
{"(foo((a * b)) + bar((c / d), e))"},
}

for i, tt := range tests {
Expand Down

0 comments on commit 542749a

Please sign in to comment.