From 0f031c5f22a95dfc3bbbe56d63b2a21d5ba9ccfd Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Fri, 17 Feb 2017 18:24:01 +0200 Subject: [PATCH] Renamed 'allowui' to 'clearscope'. 'allowui' doesn't reflect the real meaning of the keyword which clears implicit 'play' or 'ui' inherited from parent class (for classes) or owning type (for methods/fields) --- src/sc_man_scanner.re | 2 +- src/sc_man_tokens.h | 2 +- src/scripting/backend/codegen.h | 6 +++--- src/scripting/zscript/zcc-parse.lemon | 6 +++--- src/scripting/zscript/zcc_compile.cpp | 20 ++++++++++---------- src/scripting/zscript/zcc_parser.cpp | 2 +- src/scripting/zscript/zcc_parser.h | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/sc_man_scanner.re b/src/sc_man_scanner.re index 69dcd4397..560c2b077 100644 --- a/src/sc_man_scanner.re +++ b/src/sc_man_scanner.re @@ -173,7 +173,7 @@ std2: 'nonew' { RET(TK_NoNew); } 'ui' { RET(TK_UI); } 'play' { RET(TK_Play); } - 'allowui' { RET(TK_AllowUI); } + 'clearscope' { RET(TK_ClearScope); } 'super' { RET(TK_Super); } 'global' { RET(TK_Global); } 'stop' { RET(TK_Stop); } diff --git a/src/sc_man_tokens.h b/src/sc_man_tokens.h index 1dc205504..b98c1108b 100644 --- a/src/sc_man_tokens.h +++ b/src/sc_man_tokens.h @@ -115,7 +115,7 @@ xx(TK_VarArg, "'vararg'") xx(TK_NoNew, "'nonew'") xx(TK_UI, "'ui'") xx(TK_Play, "'play'") -xx(TK_AllowUI, "'allowui'") +xx(TK_ClearScope, "'clearscope'") xx(TK_Override, "'override'") xx(TK_Super, "'super'") xx(TK_Null, "'null'") diff --git a/src/scripting/backend/codegen.h b/src/scripting/backend/codegen.h index 429cfd186..ecdeaec15 100644 --- a/src/scripting/backend/codegen.h +++ b/src/scripting/backend/codegen.h @@ -71,7 +71,7 @@ class FxLocalVariableDeclaration; typedef TDeletingArray FArgumentList; // [ZZ] this is kind of related to compile context as well -struct FPlayUIBarrier +struct FScopeBarrier { bool callable; bool readable; @@ -118,7 +118,7 @@ struct FPlayUIBarrier } } - FPlayUIBarrier() + FScopeBarrier() { sidefrom = -1; sidelast = -1; @@ -127,7 +127,7 @@ struct FPlayUIBarrier writable = true; } - FPlayUIBarrier(int flags1, int flags2, const char* name) + FScopeBarrier(int flags1, int flags2, const char* name) { sidefrom = -1; sidelast = -1; diff --git a/src/scripting/zscript/zcc-parse.lemon b/src/scripting/zscript/zcc-parse.lemon index c801950b5..59924b634 100644 --- a/src/scripting/zscript/zcc-parse.lemon +++ b/src/scripting/zscript/zcc-parse.lemon @@ -216,7 +216,7 @@ class_flags(X) ::= class_flags(A) NONEW. { X.Flags = A.Flags | ZCC_NoNew; X. class_flags(X) ::= class_flags(A) NATIVE. { X.Flags = A.Flags | ZCC_Native; X.Replaces = A.Replaces; } class_flags(X) ::= class_flags(A) UI. { X.Flags = A.Flags | ZCC_UIFlag; X.Replaces = A.Replaces; } class_flags(X) ::= class_flags(A) PLAY. { X.Flags = A.Flags | ZCC_Play; X.Replaces = A.Replaces; } -class_flags(X) ::= class_flags(A) ALLOWUI. { X.Flags = A.Flags | ZCC_AllowUI; X.Replaces = A.Replaces; } +class_flags(X) ::= class_flags(A) CLEARSCOPE. { X.Flags = A.Flags | ZCC_ClearScope; X.Replaces = A.Replaces; } class_flags(X) ::= class_flags(A) REPLACES dottable_id(B). { X.Flags = A.Flags; X.Replaces = B; } /*----- Dottable Identifier -----*/ @@ -332,7 +332,7 @@ struct_def(X) ::= STRUCT(T) IDENTIFIER(A) struct_flags(S) LBRACE opt_struct_body struct_flags(X) ::= . { X.Flags = 0; } struct_flags(X) ::= struct_flags(A) UI. { X.Flags = A.Flags | ZCC_UIFlag; } struct_flags(X) ::= struct_flags(A) PLAY. { X.Flags = A.Flags | ZCC_Play; } -struct_flags(X) ::= struct_flags(A) ALLOWUI. { X.Flags = A.Flags | ZCC_AllowUI; } +struct_flags(X) ::= struct_flags(A) CLEARSCOPE. { X.Flags = A.Flags | ZCC_ClearScope; } struct_flags(X) ::= struct_flags(A) NATIVE. { X.Flags = A.Flags | ZCC_Native; } opt_struct_body(X) ::= . { X = NULL; } @@ -1008,7 +1008,7 @@ decl_flag(X) ::= OVERRIDE(T). { X.Int = ZCC_Override; X.SourceLoc = T.SourceLoc decl_flag(X) ::= VARARG(T). { X.Int = ZCC_VarArg; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= UI(T). { X.Int = ZCC_UIFlag; X.SourceLoc = T.SourceLoc; } decl_flag(X) ::= PLAY(T). { X.Int = ZCC_Play; X.SourceLoc = T.SourceLoc; } -decl_flag(X) ::= ALLOWUI(T). { X.Int = ZCC_AllowUI; X.SourceLoc = T.SourceLoc; } +decl_flag(X) ::= CLEARSCOPE(T). { X.Int = ZCC_ClearScope; X.SourceLoc = T.SourceLoc; } func_const(X) ::= . { X.Int = 0; X.SourceLoc = stat->sc->GetMessageLine(); } func_const(X) ::= CONST(T). { X.Int = ZCC_FuncConst; X.SourceLoc = T.SourceLoc; } diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 1418377c0..2d2f84492 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -615,7 +615,7 @@ void ZCCCompiler::CreateClassTypes() if (c->cls->Flags & ZCC_NoNew || (parent->ObjectFlags & OF_NoNew)) c->Type()->ObjectFlags |= OF_NoNew; // - static int incompatible[] = { ZCC_UIFlag, ZCC_Play, ZCC_AllowUI }; + static int incompatible[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope }; int incompatiblecnt = 0; for (int k = 0; k < countof(incompatible); k++) if (incompatible[k] & c->cls->Flags) incompatiblecnt++; @@ -625,9 +625,9 @@ void ZCCCompiler::CreateClassTypes() Error(c->cls, "Class %s has incompatible flags", c->NodeName().GetChars()); } - if (c->cls->Flags & ZCC_UIFlag || ((parent->ObjectFlags & OF_UI) && !(c->cls->Flags & ZCC_AllowUI))) + if (c->cls->Flags & ZCC_UIFlag || ((parent->ObjectFlags & OF_UI) && !(c->cls->Flags & ZCC_ClearScope))) c->Type()->ObjectFlags = (c->Type()->ObjectFlags&~OF_Play) | OF_UI; - if (c->cls->Flags & ZCC_Play || ((parent->ObjectFlags & OF_Play) && !(c->cls->Flags & ZCC_AllowUI))) + if (c->cls->Flags & ZCC_Play || ((parent->ObjectFlags & OF_Play) && !(c->cls->Flags & ZCC_ClearScope))) c->Type()->ObjectFlags = (c->Type()->ObjectFlags&~OF_UI) | OF_Play; c->Type()->bExported = true; // this class is accessible to script side type casts. (The reason for this flag is that types like PInt need to be skipped.) @@ -1097,7 +1097,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray &Fiel varflags = (varflags&~VARF_Play) | VARF_UI; if (field->Flags & ZCC_Play) varflags = (varflags&~VARF_UI) | VARF_Play; - if (field->Flags & ZCC_AllowUI) + if (field->Flags & ZCC_ClearScope) varflags = (varflags&~(VARF_UI | VARF_Play)); if (field->Flags & ZCC_Native) @@ -1105,7 +1105,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray &Fiel varflags |= VARF_Native | VARF_Transient; } - static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_AllowUI }; + static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope }; int excludeflags = 0; int fc = 0; for (int i = 0; i < countof(excludescope); i++) @@ -1265,7 +1265,7 @@ bool ZCCCompiler::CompileProperties(PClass *type, TArray &Proper FString ZCCCompiler::FlagsToString(uint32_t flags) { - const char *flagnames[] = { "native", "static", "private", "protected", "latent", "final", "meta", "action", "deprecated", "readonly", "const", "abstract", "extend", "virtual", "override", "transient", "vararg", "nonew", "ui", "play", "allowui" }; + const char *flagnames[] = { "native", "static", "private", "protected", "latent", "final", "meta", "action", "deprecated", "readonly", "const", "abstract", "extend", "virtual", "override", "transient", "vararg", "nonew", "ui", "play", "clearscope" }; FString build; for (size_t i = 0; i < countof(flagnames); i++) @@ -2120,12 +2120,12 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool if (c->Type()->ObjectFlags & OF_Play) varflags |= VARF_Play; if (f->Flags & ZCC_FuncConst) - varflags = (varflags&~(VARF_Play | VARF_UI)); // const implies allowui. this is checked a bit later to also not have ZCC_Play/ZCC_UIFlag. + varflags = (varflags&~(VARF_Play | VARF_UI)); // const implies clearscope. this is checked a bit later to also not have ZCC_Play/ZCC_UIFlag. if (f->Flags & ZCC_UIFlag) varflags = (varflags&~VARF_Play) | VARF_UI; if (f->Flags & ZCC_Play) varflags = (varflags&~VARF_UI) | VARF_Play; - if (f->Flags & ZCC_AllowUI) + if (f->Flags & ZCC_ClearScope) varflags = (varflags&~(VARF_Play | VARF_UI)); if ((f->Flags & ZCC_VarArg) && !(f->Flags & ZCC_Native)) @@ -2180,7 +2180,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool Error(f, "Invalid combination of qualifiers %s on function %s", FlagsToString(f->Flags&(ZCC_FuncConst | ZCC_UIFlag | ZCC_Play)).GetChars(), FName(f->Name).GetChars()); } - static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_AllowUI }; + static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope }; excludeflags = 0; fc = 0; for (int i = 0; i < countof(excludescope); i++) @@ -2408,7 +2408,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool { Error(f, "Attempt to override final function %s", FName(f->Name).GetChars()); } - // you can't change ui/play/allowui for a virtual method. + // you can't change ui/play/clearscope for a virtual method. if ((oldfunc->ScopePlay != sym->Variants[0].Implementation->ScopePlay) || (oldfunc->ScopeUI != sym->Variants[0].Implementation->ScopeUI)) { diff --git a/src/scripting/zscript/zcc_parser.cpp b/src/scripting/zscript/zcc_parser.cpp index 2586cb8c5..d77028d60 100644 --- a/src/scripting/zscript/zcc_parser.cpp +++ b/src/scripting/zscript/zcc_parser.cpp @@ -139,7 +139,7 @@ static void InitTokenMap() TOKENDEF (TK_VarArg, ZCC_VARARG); TOKENDEF (TK_UI, ZCC_UI); TOKENDEF (TK_Play, ZCC_PLAY); - TOKENDEF (TK_AllowUI, ZCC_ALLOWUI); + TOKENDEF (TK_ClearScope, ZCC_CLEARSCOPE); TOKENDEF (TK_NoNew, ZCC_NONEW); TOKENDEF (TK_Override, ZCC_OVERRIDE); TOKENDEF (TK_Final, ZCC_FINAL); diff --git a/src/scripting/zscript/zcc_parser.h b/src/scripting/zscript/zcc_parser.h index 72f81c1cc..20ebcabae 100644 --- a/src/scripting/zscript/zcc_parser.h +++ b/src/scripting/zscript/zcc_parser.h @@ -40,7 +40,7 @@ enum ZCC_NoNew = 1 << 17, ZCC_UIFlag = 1 << 18, // there's also token called ZCC_UI ZCC_Play = 1 << 19, - ZCC_AllowUI = 1 << 20, + ZCC_ClearScope = 1 << 20, }; // Function parameter modifiers