Skip to content

Commit

Permalink
Merged fix global/static/local
Browse files Browse the repository at this point in the history
  • Loading branch information
HotKeyIt committed Dec 26, 2017
1 parent 75ae48d commit d02582c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions source/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6405,20 +6405,20 @@ ResultType Script::ParseAndAddLine(LPTSTR aLineText, ActionTypeType aActionType
// appear above this line:
if (mNextLineIsFunctionBody)
{
if (g->CurrentFunc->mDefaultVarType == VAR_DECLARE_NONE)
if (declare_type == VAR_DECLARE_LOCAL)
{
if (declare_type == VAR_DECLARE_LOCAL)
declare_type |= VAR_FORCE_LOCAL; // v1.1.27: "local" by itself restricts globals to only those declared inside the function.
g->CurrentFunc->mDefaultVarType = declare_type;
// No further action is required.
return OK;
// v1.1.27: "local" by itself restricts globals to only those declared inside the function.
declare_type |= VAR_FORCE_LOCAL;
}
// v1.1.27: Allow "local" and "static" to be combined, leaving the restrictions on globals in place.
else if (g->CurrentFunc->mDefaultVarType == (VAR_DECLARE_LOCAL | VAR_FORCE_LOCAL) && declare_type == VAR_DECLARE_STATIC)
{
g->CurrentFunc->mDefaultVarType = (VAR_DECLARE_STATIC | VAR_FORCE_LOCAL);
return OK;
}
g->CurrentFunc->mDefaultVarType = declare_type;
// No further action is required.
return OK;
}
// Otherwise, it occurs too far down in the body.
return ScriptError(ERR_UNRECOGNIZED_ACTION, aLineText); // Vague error since so rare.
Expand Down

0 comments on commit d02582c

Please sign in to comment.