Changeset 27032 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp
- Timestamp:
- Oct 25, 2007, 2:25:17 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes.cpp
r27028 r27032 2618 2618 JSObject* variableObject = context->variableObject(); 2619 2619 2620 int minAttributes = Internal | DontDelete; 2621 2620 2622 // The order of additions to the variable object here implicitly enforces the mutual exclusion described in ECMA 10.1.3. 2621 2623 for (i = 0, size = m_varStack.size(); i < size; ++i) { 2622 2624 VarDeclNode* node = m_varStack[i]; 2623 int flags = Internal | DontDelete;2625 int attributes = minAttributes; 2624 2626 if (node->varType == VarDeclNode::Constant) 2625 flags |= ReadOnly;2626 variableObject->put(exec, node->ident, jsUndefined(), flags);2627 attributes |= ReadOnly; 2628 variableObject->put(exec, node->ident, jsUndefined(), attributes); 2627 2629 } 2628 2630 … … 2633 2635 for (i = 0, size = m_functionStack.size(); i < size; ++i) { 2634 2636 FuncDeclNode* node = m_functionStack[i]; 2635 variableObject->put(exec, node->ident, node->makeFunction(exec), Internal | DontDelete);2637 variableObject->put(exec, node->ident, node->makeFunction(exec), minAttributes); 2636 2638 } 2637 2639 } … … 2643 2645 Context* context = exec->context(); 2644 2646 JSObject* variableObject = context->variableObject(); 2645 2646 // The order of additions to the variable object here implicitly enforces the mutual exclusion described in ECMA 10.1.3. 2647 2648 int minAttributes = Internal | (exec->context()->codeType() != EvalCode ? DontDelete : 0); 2649 2647 2650 for (i = 0, size = m_varStack.size(); i < size; ++i) { 2648 2651 VarDeclNode* node = m_varStack[i]; 2649 if (!variableObject->hasProperty(exec, node->ident)) { 2650 int flags = Internal; 2651 if (context->codeType() != EvalCode) 2652 flags |= DontDelete; 2653 if (node->varType == VarDeclNode::Constant) 2654 flags |= ReadOnly; 2655 variableObject->put(exec, node->ident, jsUndefined(), flags); 2656 } 2652 if (variableObject->hasProperty(exec, node->ident)) 2653 continue; 2654 int attributes = minAttributes; 2655 if (node->varType == VarDeclNode::Constant) 2656 attributes |= ReadOnly; 2657 variableObject->put(exec, node->ident, jsUndefined(), attributes); 2657 2658 } 2658 2659 const List& args = *context->arguments(); 2660 for (i = 0, size = m_parameters.size(); i < size; ++i) 2661 variableObject->put(exec, m_parameters[i], args[i], DontDelete); 2659 2660 ASSERT(!m_parameters.size()); 2662 2661 2663 2662 for (i = 0, size = m_functionStack.size(); i < size; ++i) { 2664 2663 FuncDeclNode* node = m_functionStack[i]; 2665 variableObject->put(exec, node->ident, node->makeFunction(exec), Internal | (context->codeType() == EvalCode ? 0 : DontDelete));2664 variableObject->put(exec, node->ident, node->makeFunction(exec), minAttributes); 2666 2665 } 2667 2666 }
Note:
See TracChangeset
for help on using the changeset viewer.