Skip to content

Commit a952d36

Browse files
committed
Fix number of arity when parsing function declaration with more than 1 parameter
1 parent 30934be commit a952d36

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lilo/src/main/java/com/amrdeveloper/lilo/LiloParser.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class LiloParser(private val tokens: List<Token>, private val diagnostics: LiloD
7070
val parameters = mutableListOf<Token>()
7171
if (checkPeek(TokenType.TOKEN_OPEN_PAREN)) {
7272
while (isAtEnd().not() && peek().type != TokenType.TOKEN_CLOSE_PAREN) {
73-
parameters.add(peek())
74-
advance()
73+
parameters.add(advance())
74+
if (peek().type == TokenType.TOKEN_COMMA) advance()
7575
}
7676
consume(TokenType.TOKEN_CLOSE_PAREN, "Expect ) after function parameters.")
7777
}

0 commit comments

Comments
 (0)