function arguments are getting added to the AST!

This commit is contained in:
SpookyDervish
2025-10-15 07:16:15 +11:00
parent 049db7c53a
commit 3c24b50a80
8 changed files with 123 additions and 25 deletions

View File

@@ -6,18 +6,37 @@
"type": "FunctionStatement",
"name": {
"type": "IdentifierLiteral",
"value": "test"
"value": "add"
},
"return_type": "Int",
"parameters": [],
"parameters": [
{
"type": "FunctionParameter",
"name": "a",
"value_type": "Int"
},
{
"type": "FunctionParameter",
"name": "b",
"value_type": "Int"
}
],
"body": {
"type": "BlockStatement",
"statements": [
{
"type": "ReturnStatement",
"return_value": {
"type": "IntegerLiteral",
"value": 123
"type": "InfixExpression",
"left_node": {
"type": "IdentifierLiteral",
"value": "a"
},
"operator": "+",
"right_node": {
"type": "IdentifierLiteral",
"value": "b"
}
}
}
]
@@ -42,9 +61,18 @@
"type": "CallExpression",
"function": {
"type": "IdentifierLiteral",
"value": "test"
"value": "add"
},
"arguments": []
"arguments": [
{
"type": "IntegerLiteral",
"value": 2
},
{
"type": "IntegerLiteral",
"value": 3
}
]
}
}
]