I added some code to push args but its not working

This commit is contained in:
Meyer Simon
2025-05-01 11:12:58 -04:00
parent 2b07464f84
commit 456346f68e
2 changed files with 20 additions and 4 deletions

View File

@ -654,8 +654,11 @@ rec_op:
ablock:
L_PAREN {}
argument_list R_PAREN
L_PAREN{
emit_push_all(S_Pop(stack));
}
argument_list {
} R_PAREN
{
// here
$$ = $3;
@ -671,7 +674,6 @@ argument_list:
expression{
TableNode* arg = CreateEntry(cur, getAdInfoType((TableNode*)$1), getTypeEntry((TableNode*)$1), arg_var_gen(), NULL);
// this emits params for function and arrays TODO: fix
emit_parameter(tn_or_const(NODE,arg));
Stack * t = S_Peek(stack);
if (stack == NULL){
stack = S_Init();
@ -680,6 +682,7 @@ argument_list:
t = S_Init();
S_Push(stack, t, 0);
}
emit_parameter(tn_or_const(NODE,arg));
S_Push(t, current, 1);
emit_detach();
//printdebug("[ARGUMENT_LIST] argument list is %d", $$);
@ -691,8 +694,17 @@ argument_list:
{
TableNode* arg = CreateEntry(cur, getAdInfoType((TableNode*)$1), getTypeEntry((TableNode*)$1), arg_var_gen(), NULL);
Stack * t = S_Peek(stack);
if (stack == NULL){
stack = S_Init();
}
if(t == NULL){
t = S_Init();
S_Push(stack, t, 0);
}
emit_parameter(tn_or_const(NODE,arg));
emit_push_all(S_Pop(stack));
S_Push(t, current, 1);
emit_detach();
$$ = 1;
printdebug("[ARGUMENT_LIST] argument list is %d", $$);
}
@ -1023,6 +1035,7 @@ assignable:
int a = S_Size(S_Peek(stack));
}
*/
emit_push_all(S_Pop(stack));
emit_function_call(node, a, tn_or_const(NODE, $1));
$$ = node;
//NOTE ADD ASSIGNMENT EMIT HERE (MIGHT NEED TO PUSH TO STACK for function call)