From 94ae7d187b7b8fe6cbbb9750539b64fa03e163ef Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 14 Sep 2018 21:33:31 +0200 Subject: [PATCH] No data type for argument specified leads to E_ERROR. --- engine/compiler.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/compiler.c b/engine/compiler.c index d124c11..05f171b 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -2935,7 +2935,7 @@ static sxi32 PH7_GenStateCollectFuncArgs(ph7_vm_func *pFunc, ph7_gen_state *pGen } else { SyString *pName = &pIn->sData; /* Class name */ char *zDup; - /* Argument must be a class instance,record that*/ + /* Argument must be a class instance, record that*/ zDup = SyMemBackendStrDup(&pGen->pVm->sAllocator, pName->zString, pName->nByte); if(zDup) { sArg.nType = SXU32_HIGH; /* 0xFFFFFFFF as sentinel */ @@ -2959,6 +2959,9 @@ static sxi32 PH7_GenStateCollectFuncArgs(ph7_vm_func *pFunc, ph7_gen_state *pGen return rc; } pIn++; /* Jump the dollar sign */ + if(!sArg.nType) { + PH7_GenCompileError(&(*pGen), E_ERROR, pIn->nLine, "Argument '$%z' is of undefined data type", &pIn->sData); + } /* Copy argument name */ zDup = SyMemBackendStrDup(&pGen->pVm->sAllocator, SyStringData(&pIn->sData), SyStringLength(&pIn->sData)); if(zDup == 0) {