mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:25:08 +00:00
LibJS: Add parsed parameters to FunctionDeclaration
This commit is contained in:
parent
83ea7bb9e7
commit
0e04e2cff0
1 changed files with 4 additions and 3 deletions
|
@ -245,9 +245,10 @@ NonnullOwnPtr<FunctionDeclaration> Parser::parse_function_declaration()
|
|||
consume(TokenType::Function);
|
||||
auto name = consume(TokenType::Identifier).value();
|
||||
consume(TokenType::ParenOpen);
|
||||
Vector<String> parameters;
|
||||
while (match(TokenType::Identifier)) {
|
||||
// FIXME: actually add parameters to function
|
||||
consume(TokenType::Identifier);
|
||||
auto parameter = consume(TokenType::Identifier).value();
|
||||
parameters.append(parameter);
|
||||
if (match(TokenType::ParenClose)) {
|
||||
break;
|
||||
}
|
||||
|
@ -255,7 +256,7 @@ NonnullOwnPtr<FunctionDeclaration> Parser::parse_function_declaration()
|
|||
}
|
||||
consume(TokenType::ParenClose);
|
||||
auto body = parse_block_statement();
|
||||
return make<FunctionDeclaration>(name, move(body));
|
||||
return make<FunctionDeclaration>(name, move(body), move(parameters));
|
||||
}
|
||||
|
||||
NonnullOwnPtr<VariableDeclaration> Parser::parse_variable_declaration()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue