From ca9ef8f4a5ba82e557c8d8ef0859dddd9af0cd0c Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Thu, 29 Jun 2000 03:15:52 +0000 Subject: [PATCH] fixed static calls. git-svn-id: svn://10.0.0.236/trunk@73499 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/js2/icodegenerator.cpp | 2 +- mozilla/js/js2/interpreter.cpp | 7 +++++-- mozilla/js2/src/icodegenerator.cpp | 2 +- mozilla/js2/src/interpreter.cpp | 7 +++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mozilla/js/js2/icodegenerator.cpp b/mozilla/js/js2/icodegenerator.cpp index b810ac70742..78271d1c24a 100644 --- a/mozilla/js/js2/icodegenerator.cpp +++ b/mozilla/js/js2/icodegenerator.cpp @@ -818,7 +818,7 @@ TypedRegister ICodeGenerator::genExpr(ExprNode *p, const StringAtom &className = (static_cast(b->op1))->name; const JSValue &v = mGlobal->getVariable(className); JSClass* c = dynamic_cast(v.type); - if (c && c->getScope()->hasProperty(name)) { + if (c && c->hasStatic(name)) { ret = staticCall(c, name, args); break; } diff --git a/mozilla/js/js2/interpreter.cpp b/mozilla/js/js2/interpreter.cpp index de5a853f8a1..c4d97897c16 100644 --- a/mozilla/js/js2/interpreter.cpp +++ b/mozilla/js/js2/interpreter.cpp @@ -529,9 +529,12 @@ JSValue Context::interpret(ICodeModule* iCode, const JSValues& args) case STATIC_CALL: { + // FIXME: static call should use its static index. StaticCall* call = static_cast(instruction); - ASSERT(op2(call)->getScope()->getProperty(*op3(call)).isFunction()); - JSFunction *target = op2(call)->getScope()->getProperty(*op3(call)).function; + JSClass* thisClass = op2(call); + const JSValue& value = (*thisClass)[thisClass->getStatic(*op3(call)).mIndex]; + ASSERT(value.isFunction()); + JSFunction *target = value.function; if (target->isNative()) { RegisterList ¶ms = op4(call); JSValues argv(params.size() + 1); diff --git a/mozilla/js2/src/icodegenerator.cpp b/mozilla/js2/src/icodegenerator.cpp index b810ac70742..78271d1c24a 100644 --- a/mozilla/js2/src/icodegenerator.cpp +++ b/mozilla/js2/src/icodegenerator.cpp @@ -818,7 +818,7 @@ TypedRegister ICodeGenerator::genExpr(ExprNode *p, const StringAtom &className = (static_cast(b->op1))->name; const JSValue &v = mGlobal->getVariable(className); JSClass* c = dynamic_cast(v.type); - if (c && c->getScope()->hasProperty(name)) { + if (c && c->hasStatic(name)) { ret = staticCall(c, name, args); break; } diff --git a/mozilla/js2/src/interpreter.cpp b/mozilla/js2/src/interpreter.cpp index de5a853f8a1..c4d97897c16 100644 --- a/mozilla/js2/src/interpreter.cpp +++ b/mozilla/js2/src/interpreter.cpp @@ -529,9 +529,12 @@ JSValue Context::interpret(ICodeModule* iCode, const JSValues& args) case STATIC_CALL: { + // FIXME: static call should use its static index. StaticCall* call = static_cast(instruction); - ASSERT(op2(call)->getScope()->getProperty(*op3(call)).isFunction()); - JSFunction *target = op2(call)->getScope()->getProperty(*op3(call)).function; + JSClass* thisClass = op2(call); + const JSValue& value = (*thisClass)[thisClass->getStatic(*op3(call)).mIndex]; + ASSERT(value.isFunction()); + JSFunction *target = value.function; if (target->isNative()) { RegisterList ¶ms = op4(call); JSValues argv(params.size() + 1);