Changeset 27394 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp
- Timestamp:
- Nov 3, 2007, 3:09:45 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes.cpp
r27389 r27394 56 56 57 57 #define KJS_CHECKEXCEPTIONLIST \ 58 if (exec->hadException()) { \ 59 handleException(exec); \ 60 return; \ 61 } 62 63 #define KJS_CHECKEXCEPTIONVOID \ 58 64 if (exec->hadException()) { \ 59 65 handleException(exec); \ … … 2473 2479 void VarDeclNode::optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack& nodeStack) 2474 2480 { 2481 if (next) 2482 nodeStack.append(next.get()); 2475 2483 if (init) 2476 2484 nodeStack.append(init.get()); 2477 2485 } 2478 2486 2479 2487 void VarDeclNode::getDeclarations(DeclarationStacks& stacks) 2480 2488 { 2489 if (next) { 2490 ASSERT(next->mayHaveDeclarations()); 2491 stacks.nodeStack.append(next.get()); 2492 } 2493 2481 2494 // The normal check to avoid overwriting pre-existing values with variable 2482 2495 // declarations doesn't work for the "arguments" property because we … … 2488 2501 } 2489 2502 2490 JSValue*VarDeclNode::handleSlowCase(ExecState* exec, const ScopeChain& chain, JSValue* val)2503 void VarDeclNode::handleSlowCase(ExecState* exec, const ScopeChain& chain, JSValue* val) 2491 2504 { 2492 2505 ScopeChainIterator iter = chain.begin(); … … 2513 2526 2514 2527 base->put(exec, ident, val, flags); 2515 return 0;2516 2528 } 2517 2529 2518 2530 // ECMA 12.2 2519 JSValue* VarDeclNode::evaluate(ExecState* exec)2531 inline void VarDeclNode::evaluateSingle(ExecState* exec) 2520 2532 { 2521 2533 const ScopeChain& chain = exec->scopeChain(); … … 2536 2548 } else if (init) { 2537 2549 JSValue* val = init->evaluate(exec); 2538 KJS_CHECKEXCEPTIONV ALUE2550 KJS_CHECKEXCEPTIONVOID 2539 2551 2540 2552 // if the variable object is the top of the scope chain, then that must … … 2552 2564 variableObject->put(exec, ident, val, flags); 2553 2565 } 2554 2555 // no caller of this function actually uses the return value. 2556 // FIXME: It would be better to change the inheritence hierarchy so this 2557 // node doesn't even have an evaluate method, but instead a differently named 2558 // one with a void return. 2559 return 0; 2560 } 2561 2562 // ------------------------------ VarDeclListNode ------------------------------ 2563 2564 void VarDeclListNode::optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack& nodeStack) 2565 { 2566 if (next) 2567 nodeStack.append(next.get()); 2568 nodeStack.append(var.get()); 2569 } 2570 2571 // ECMA 12.2 2572 JSValue *VarDeclListNode::evaluate(ExecState *exec) 2573 { 2574 for (VarDeclListNode *n = this; n; n = n->next.get()) { 2575 n->var->evaluate(exec); 2576 KJS_CHECKEXCEPTIONVALUE 2577 } 2578 return jsUndefined(); 2579 } 2580 2581 void VarDeclListNode::getDeclarations(DeclarationStacks& stacks) 2582 { 2583 if (next) { 2584 ASSERT(next->mayHaveDeclarations()); 2585 stacks.nodeStack.append(next.get()); 2566 } 2567 2568 JSValue* VarDeclNode::evaluate(ExecState* exec) 2569 { 2570 evaluateSingle(exec); 2571 2572 if (VarDeclNode* n = next.get()) { 2573 do { 2574 n->evaluateSingle(exec); 2575 KJS_CHECKEXCEPTIONVALUE 2576 n = n->next.get(); 2577 } while (n); 2586 2578 } 2587 stacks.nodeStack.append(var.get());2579 return jsUndefined(); 2588 2580 } 2589 2581 … … 2599 2591 Completion VarStatementNode::execute(ExecState *exec) 2600 2592 { 2601 KJS_BREAKPOINT;2602 2603 (void)next->evaluate(exec);2604 KJS_CHECKEXCEPTION2605 2606 return Completion(Normal);2593 KJS_BREAKPOINT; 2594 2595 next->evaluate(exec); 2596 KJS_CHECKEXCEPTION 2597 2598 return Completion(Normal); 2607 2599 } 2608 2600
Note:
See TracChangeset
for help on using the changeset viewer.