Permalink
Browse files

Fixed class declarations conflicting with #MustDeclare.

  • Loading branch information...
1 parent 6140212 commit ed9e63933440df7c61da920d85cbc01cf181a3e1 @Lexikos committed Feb 29, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 source/script.cpp
View
@@ -6272,15 +6272,14 @@ ResultType Script::DefineClass(LPTSTR aBuf)
else // Top-level class definition.
{
*mClassName = '\0'; // Init.
- if ( !(class_var = FindOrAddVar(class_name)) )
+ if ( !(class_var = FindOrAddVar(class_name, 0, VAR_DECLARE_SUPER_GLOBAL)) )
return FAIL;
if (class_var->IsObject())
// At this point it can only be an Object() created by a class definition.
class_object = (Object *)class_var->Object();
else
- // Force the variable to be super-global rather than passing this flag to
- // FindOrAddVar: a prior reference to this variable may have created it as
- // an ordinary global.
+ // Explicitly set the variable scope, since FindOrAddVar may have returned
+ // an existing ordinary global instead of creating a super-global.
class_var->Scope() = VAR_DECLARE_SUPER_GLOBAL;
}

0 comments on commit ed9e639

Please sign in to comment.