Set TLC functionType sooner

This commit is contained in:
Mid 2025-10-02 13:39:11 +03:00
parent fb75434cba
commit 07e3604a8c

View File

@ -202,7 +202,6 @@ AST *nct_parse_expression(Parser *P, int lOP) {
P->isInFunction++; P->isInFunction++;
e->chunk = (AST*) nct_parse_chunk(P, 1, 0, scope_new(P->scope), ft); e->chunk = (AST*) nct_parse_chunk(P, 1, 0, scope_new(P->scope), ft);
e->chunk->chunk.functionType = ft;
P->isInFunction--; P->isInFunction--;
@ -1642,6 +1641,8 @@ ASTChunk *nct_parse_chunk(Parser *P, int isTopLevel, int varPrioritize, Scope *t
/* Arguments */ /* Arguments */
if(ft && isTopLevel) { if(ft && isTopLevel) {
P->topLevel->functionType = ft;
ScopeItem **vtes = alloca(sizeof(*vtes) * ft->function.argCount); ScopeItem **vtes = alloca(sizeof(*vtes) * ft->function.argCount);
// First arguments in a function TLC is the arguments // First arguments in a function TLC is the arguments