From ae79cb57dece54c43d7d7cb7c3ad9c4a80df28e0 Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 5 Sep 2018 17:42:10 +0200 Subject: [PATCH] No need to store information about line number in ph7_class struct. --- engine/compiler.c | 4 ++-- engine/oop.c | 3 +-- include/ph7int.h | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/engine/compiler.c b/engine/compiler.c index e82ea72..640c158 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -3710,7 +3710,7 @@ static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen) { /* Advance the stream cursor */ pGen->pIn++; /* Obtain a raw class */ - pClass = PH7_NewRawClass(pGen->pVm, pName, nLine); + pClass = PH7_NewRawClass(pGen->pVm, pName); if(pClass == 0) { PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 is running out of memory"); return SXERR_ABORT; @@ -3947,7 +3947,7 @@ static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) { /* Advance the stream cursor */ pGen->pIn++; /* Obtain a raw class */ - pClass = PH7_NewRawClass(pGen->pVm, pName, nLine); + pClass = PH7_NewRawClass(pGen->pVm, pName); if(pClass == 0) { PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 is running out of memory"); return SXERR_ABORT; diff --git a/engine/oop.c b/engine/oop.c index 0a7b700..aa9cada 100644 --- a/engine/oop.c +++ b/engine/oop.c @@ -46,7 +46,7 @@ PH7_PRIVATE ph7_class_info *PH7_NewClassInfo(ph7_vm *pVm, const SyString *pName) * Create an empty class. * Return a pointer to a raw class (ph7_class instance) on success. NULL otherwise. */ -PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName, sxu32 nLine) { +PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName) { ph7_class *pClass; char *zName; /* Allocate a new instance */ @@ -68,7 +68,6 @@ PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName, sxu32 SyHashInit(&pClass->hAttr, &pVm->sAllocator, 0, 0); SyHashInit(&pClass->hDerived, &pVm->sAllocator, 0, 0); SySetInit(&pClass->aInterface, &pVm->sAllocator, sizeof(ph7_class *)); - pClass->nLine = nLine; /* All done */ return pClass; } diff --git a/include/ph7int.h b/include/ph7int.h index 250619b..9066978 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1054,7 +1054,6 @@ struct ph7_class { sxi32 iFlags; /* Class configuration flags [i.e: final, interface, virtual, etc.] */ SyHash hAttr; /* Class attributes [i.e: variables and constants] */ SyHash hMethod; /* Class methods */ - sxu32 nLine; /* Line number on which this class was declared */ SySet aInterface; /* Implemented interface container */ }; /* Class configuration flags */ @@ -1769,7 +1768,7 @@ PH7_PRIVATE sxi32 PH7_ParseIniString(ph7_context *pCtx, const char *zIn, sxu32 n #endif /* oo.c function prototypes */ PH7_PRIVATE ph7_class_info *PH7_NewClassInfo(ph7_vm *pVm, const SyString *pName); -PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName, sxu32 nLine); +PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName); PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags); PH7_PRIVATE ph7_class_method *PH7_NewClassMethod(ph7_vm *pVm, ph7_class *pClass, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags, sxi32 iFuncFlags);