Permalink
Browse files

[VM] Only add the class object to the scope of constructors and insta…

…nce methods, but not static methods.

This reduces test suite failures by 4 without crashing any existing testcases. Yay!
  • Loading branch information...
timonvo committed Mar 10, 2012
1 parent a91a19d commit 2c307cd00bebb5dd23474de0eb4fd2f1ff9c2b72
Showing with 7 additions and 2 deletions.
  1. +5 −0 src/scripting/abc.cpp
  2. +2 −2 src/scripting/abc_opcodes.cpp
View
@@ -1770,6 +1770,11 @@ void ABCContext::buildTrait(ASObject* obj, const traits_info* t, bool isBorrowed
//Methods save a copy of the scope stack of the class
f->acquireScope(prot->class_scope);
+ if(isBorrowed)
+ {
+ obj->incRef();
+ f->addToScope(scope_entry(_MR(obj),false));
+ }
}
else
{
@@ -1923,8 +1923,6 @@ void ABCVm::newClass(call_context* th, int n)
ret->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(Class_base::_toString),NORMAL_METHOD,false);
ret->class_scope=th->scope_stack;
- ret->incRef();
- ret->class_scope.emplace_back(scope_entry(_MR(ret),false));
LOG(LOG_CALLS,_("Building class traits"));
for(unsigned int i=0;i<th->context->classes[n].trait_count;i++)
@@ -1952,6 +1950,8 @@ void ABCVm::newClass(call_context* th, int n)
#endif
SyntheticFunction* constructorFunc=Class<IFunction>::getSyntheticFunction(constructor);
constructorFunc->acquireScope(ret->class_scope);
+ ret->incRef();
+ constructorFunc->addToScope(scope_entry(_MR(ret),false));
constructorFunc->inClass = ret;
//add Constructor the the class methods
ret->constructor=constructorFunc;

0 comments on commit 2c307cd

Please sign in to comment.