- fixed: Class and struct name lookup was not context aware.
If a later module reused an existing name for a different class or struct type, this new name would completely shadow the old one, even in the base files. Changed it so that each compilation unit (i.e. each ZScript and DECORATE lump) get their own symbol table and can only see the symbol tables that got defined in lower numbered resource files so that later definitions do not pollute the available list of symbols when running the compiler backend and code generator - which happens after everything has been parsed. Another effect of this is that a mod that reuses the name of an internal global constant will only see its own constant, again reducing the risk of potential errors in case the internal definitions add some new values. Global constants are still discouraged from being used because what this does not and can not handle is the case that a mod defines a global constant with the same name as a class variable. In such a case the class variable will always take precedence for code inside that class. Note that the internal struct String had to be renamed for this because the stricter checks did not let the type String pass on the left side of a '.' anymore. - made PEnum inherit from PInt and not from PNamedType. The old inheritance broke nearly every check for integer compatibility in the compiler, so this hopefully leads to a working enum implementation.
This commit is contained in:
parent
db4c5e090d
commit
b3aa7c61a9
19 changed files with 294 additions and 220 deletions
|
|
@ -117,6 +117,7 @@ struct Baggage
|
|||
#ifdef _DEBUG
|
||||
FString ClassName; // This is here so that during debugging the class name can be seen
|
||||
#endif
|
||||
PNamespace *Namespace;
|
||||
PClassActor *Info;
|
||||
bool DropItemSet;
|
||||
bool StateSet;
|
||||
|
|
@ -132,7 +133,7 @@ struct Baggage
|
|||
|
||||
inline void ResetBaggage (Baggage *bag, PClassActor *stateclass)
|
||||
{
|
||||
bag->DropItemList = NULL;
|
||||
bag->DropItemList = nullptr;
|
||||
bag->DropItemSet = false;
|
||||
bag->CurrentState = 0;
|
||||
bag->fromDecorate = true;
|
||||
|
|
@ -150,7 +151,7 @@ AFuncDesc *FindFunction(PStruct *cls, const char * string);
|
|||
FieldDesc *FindField(PStruct *cls, const char * string);
|
||||
|
||||
|
||||
FxExpression *ParseExpression(FScanner &sc, PClassActor *cls, bool mustresolve = false);
|
||||
FxExpression *ParseExpression(FScanner &sc, PClassActor *cls, PNamespace *resolvenspc = nullptr);
|
||||
void ParseStates(FScanner &sc, PClassActor *actor, AActor *defaults, Baggage &bag);
|
||||
void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression *> &out_params,
|
||||
PFunction *afd, FString statestring, FStateDefinitions *statedef);
|
||||
|
|
@ -160,7 +161,7 @@ FName CheckCastKludges(FName in);
|
|||
void SetImplicitArgs(TArray<PType *> *args, TArray<DWORD> *argflags, TArray<FName> *argnames, PStruct *cls, DWORD funcflags, int useflags);
|
||||
PFunction *CreateAnonymousFunction(PClass *containingclass, PType *returntype, int flags);
|
||||
PFunction *FindClassMemberFunction(PStruct *cls, PStruct *funccls, FName name, FScriptPosition &sc, bool *error);
|
||||
void CreateDamageFunction(PClassActor *info, AActor *defaults, FxExpression *id, bool fromDecorate, int lumpnum);
|
||||
void CreateDamageFunction(PNamespace *ns, PClassActor *info, AActor *defaults, FxExpression *id, bool fromDecorate, int lumpnum);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -169,7 +170,7 @@ void CreateDamageFunction(PClassActor *info, AActor *defaults, FxExpression *id,
|
|||
//==========================================================================
|
||||
|
||||
void HandleActorFlag(FScanner &sc, Baggage &bag, const char *part1, const char *part2, int mod);
|
||||
FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type, bool constant);
|
||||
FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type);
|
||||
|
||||
|
||||
enum
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue