Changeset 35022 in webkit for trunk/JavaScriptCore/kjs/JSFunction.cpp
- Timestamp:
- Jul 5, 2008, 10:26:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSFunction.cpp
r35016 r35022 42 42 const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 }; 43 43 44 JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* b , ScopeChainNode* scopeChain)45 : InternalFunction(exec->lexicalGlobalObject()->functionPrototype(), name)46 , body(b)47 , _scope(scopeChain)44 JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* body, ScopeChainNode* scopeChainNode) 45 : InternalFunction(exec->lexicalGlobalObject()->functionPrototype(), name) 46 , m_body(body) 47 , m_scopeChain(scopeChainNode) 48 48 { 49 49 } … … 52 52 { 53 53 InternalFunction::mark(); 54 body->mark();55 _scope.mark();54 m_body->mark(); 55 m_scopeChain.mark(); 56 56 } 57 57 58 58 CallType JSFunction::getCallData(CallData& callData) 59 59 { 60 callData.js.functionBody = body.get();61 callData.js.scopeChain = _scope.node();60 callData.js.functionBody = m_body.get(); 61 callData.js.scopeChain = m_scopeChain.node(); 62 62 return CallTypeJS; 63 63 } … … 65 65 JSValue* JSFunction::call(ExecState* exec, JSValue* thisValue, const ArgList& args) 66 66 { 67 return exec->machine()->execute( body.get(), exec, this, thisValue->toThisObject(exec), args, _scope.node(), exec->exceptionSlot());67 return exec->machine()->execute(m_body.get(), exec, this, thisValue->toThisObject(exec), args, m_scopeChain.node(), exec->exceptionSlot()); 68 68 } 69 69 … … 83 83 { 84 84 JSFunction* thisObj = static_cast<JSFunction*>(slot.slotBase()); 85 return jsNumber(exec, thisObj-> body->parameters().size());85 return jsNumber(exec, thisObj->m_body->parameters().size()); 86 86 } 87 87 … … 129 129 const Identifier& JSFunction::getParameterName(int index) 130 130 { 131 Vector<Identifier>& parameters = body->parameters();131 Vector<Identifier>& parameters = m_body->parameters(); 132 132 133 if (static_cast<size_t>(index) >= body->parameters().size())134 return _scope.globalObject()->globalData()->propertyNames->nullIdentifier;133 if (static_cast<size_t>(index) >= m_body->parameters().size()) 134 return m_scopeChain.globalObject()->globalData()->propertyNames->nullIdentifier; 135 135 136 136 const Identifier& name = parameters[index]; … … 138 138 // Are there any subsequent parameters with the same name? 139 139 size_t size = parameters.size(); 140 for (size_t i = index + 1; i < size; ++i) 140 for (size_t i = index + 1; i < size; ++i) { 141 141 if (parameters[i] == name) 142 return _scope.globalObject()->globalData()->propertyNames->nullIdentifier; 142 return m_scopeChain.globalObject()->globalData()->propertyNames->nullIdentifier; 143 } 143 144 144 145 return name; … … 148 149 ConstructType JSFunction::getConstructData(ConstructData& constructData) 149 150 { 150 constructData.js.functionBody = body.get();151 constructData.js.scopeChain = _scope.node();151 constructData.js.functionBody = m_body.get(); 152 constructData.js.scopeChain = m_scopeChain.node(); 152 153 return ConstructTypeJS; 153 154 } … … 164 165 JSObject* thisObj = new (exec) JSObject(proto); 165 166 166 JSValue* result = exec->machine()->execute( body.get(), exec, this, thisObj, args, _scope.node(), exec->exceptionSlot());167 JSValue* result = exec->machine()->execute(m_body.get(), exec, this, thisObj, args, m_scopeChain.node(), exec->exceptionSlot()); 167 168 if (exec->hadException() || !result->isObject()) 168 169 return thisObj;
Note:
See TracChangeset
for help on using the changeset viewer.