From 1ad14487a3d956b4494defa2b60b75da5e0521e5 Mon Sep 17 00:00:00 2001 From: Daniel_Cortez Date: Sun, 25 Nov 2018 19:11:43 +0700 Subject: [PATCH] __emit: Take in account local symbols for arguments of type 'function' --- source/compiler/sc1.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c index 0421db4..4d92d2a 100644 --- a/source/compiler/sc1.c +++ b/source/compiler/sc1.c @@ -6368,18 +6368,26 @@ static void SC_FASTCALL emit_param_function(emit_outval *p,int isnative) switch (tok) { case tSYMBOL: - sym=findglb(str,sSTATEVAR); + sym=findloc(str); + if (sym==NULL) + sym=findglb(str,sSTATEVAR); if (sym==NULL) { error(17,str); /* undefined symbol */ return; } /* if */ - markusage(sym,uREAD); if (sym->ident==iFUNCTN || sym->ident==iREFFUNC) { + markusage(sym,uREAD); if (!!(sym->usage & uNATIVE)==isnative) break; tok=(isnative!=FALSE) ? teFUNCTN : teNATIVE; } else { - tok=(sym->ident==iCONSTEXPR) ? teNUMERIC : teDATA; + markusage(sym,uREAD | uWRITTEN); + if (sym->ident==iLABEL) + tok=tLABEL; + else if (sym->ident==iCONSTEXPR) + tok=teNUMERIC; + else + tok=(sym->vclass==sLOCAL) ? teLOCAL : teDATA; } /* if */ /* fallthrough */ default: