- added a compiler-side workaround for the formerly static methods of FLevelLocals.
LevelLocals on the left side of.a function call will now always be remapped to 'Level', which will either remap to the same-named instance variable or the global deprecated one. In a few degenerate cases where there is a conflicting local variable named 'level' it may error out but that is unavoidable here but this is very unlikely.
This commit is contained in:
parent
60873bc5d6
commit
f9239f6e0f
8 changed files with 132 additions and 117 deletions
|
|
@ -3290,12 +3290,10 @@ static FxExpression *ModifyAssign(FxBinary *operation, FxExpression *left)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
||||
FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast, bool substitute)
|
||||
{
|
||||
if (ast == nullptr) return nullptr;
|
||||
|
||||
// Note: Do not call 'Simplify' here because that function tends to destroy identifiers due to lack of context in which to resolve them.
|
||||
// The Fx nodes created here will be better suited for that.
|
||||
switch (ast->NodeType)
|
||||
{
|
||||
case AST_ExprFuncCall:
|
||||
|
|
@ -3317,7 +3315,7 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
|||
case AST_ExprMemberAccess:
|
||||
{
|
||||
auto ema = static_cast<ZCC_ExprMemberAccess *>(fcall->Function);
|
||||
return new FxMemberFunctionCall(ConvertNode(ema->Left), ema->Right, ConvertNodeList(args, fcall->Parameters), *ast);
|
||||
return new FxMemberFunctionCall(ConvertNode(ema->Left, true), ema->Right, ConvertNodeList(args, fcall->Parameters), *ast);
|
||||
}
|
||||
|
||||
case AST_ExprBinary:
|
||||
|
|
@ -3382,8 +3380,9 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
|||
|
||||
case AST_ExprID:
|
||||
{
|
||||
auto id = static_cast<ZCC_ExprID *>(ast);
|
||||
return new FxIdentifier(id->Identifier, *ast);
|
||||
auto id = static_cast<ZCC_ExprID *>(ast)->Identifier;
|
||||
if (id == NAME_LevelLocals && substitute) id = NAME_Level; // All static methods of FLevelLocals are now non-static so remap the name right here before passing it to the backend.
|
||||
return new FxIdentifier(id, *ast);
|
||||
}
|
||||
|
||||
case AST_ExprConstant:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue