Support calling functions with multiple arguments

This commit is contained in:
Linus Lee 2020-09-24 07:47:35 -04:00
parent d7c1ae4f76
commit a0163315d3

View File

@ -487,8 +487,11 @@ class Parser {
} }
fnCall(fnNode) { fnCall(fnNode) {
this.tokens.expect(T.Of); this.tokens.expect(T.Of);
// TODO: support multiple arguments
const args = [this.expr()]; const args = [this.expr()];
while (this.tokens.peek() === T.Comma) {
this.tokens.next(); // comma
args.push(this.expr());
}
return { return {
type: N.FnCall, type: N.FnCall,
fn: fnNode, fn: fnNode,