Changeset 9551 in webkit for trunk/JavaScriptCore/kjs/internal.h


Ignore:
Timestamp:
Jun 30, 2005, 5:45:50 PM (20 years ago)
Author:
ggaren
Message:

-rolled in KDE fix to <rdar://problem/4167660> JavaScript fails to
throw exceptions for invalid break/continue statements

No layout tests because it's already covered by the Mozilla suite

Reviewed by mjs.

  • kjs/internal.h: LabelStack now tracks where you are relative to switch and iteration (loop) statements

(KJS::LabelStack::LabelStack):
(KJS::LabelStack::pushIteration):
(KJS::LabelStack::popIteration):
(KJS::LabelStack::inIteration):
(KJS::LabelStack::pushSwitch):
(KJS::LabelStack::popSwitch):
(KJS::LabelStack::inSwitch):

  • kjs/nodes.cpp: These files were updated to use the new LabelStack: (DoWhileNode::execute): (WhileNode::execute): (ForNode::execute): (ForInNode::execute): (SwitchNode::execute):

These files were updated to throw exceptions for invalid
break/continue statements:
(BreakNode::execute):
(ContinueNode::execute):

  • tests/mozilla/expected.html: Updated expected results to reflect fix
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/internal.h

    r9145 r9551  
    164164  class LabelStack {
    165165  public:
    166     LabelStack(): tos(0L) {}
     166    LabelStack(): tos(0L), iterationDepth(0), switchDepth(0) {}
    167167    ~LabelStack();
    168168
     
    183183     */
    184184    void pop();
     185   
     186    void pushIteration() { iterationDepth++; }
     187    void popIteration() { iterationDepth--; }
     188    bool inIteration() const { return (iterationDepth > 0); }
     189   
     190    void pushSwitch() { switchDepth++; }
     191    void popSwitch() { switchDepth--; }
     192    bool inSwitch() const { return (switchDepth > 0); }
     193   
    185194  private:
    186195    struct StackElem {
     
    191200    StackElem *tos;
    192201    void clear();
     202    int iterationDepth;
     203    int switchDepth;
    193204  };
    194205
Note: See TracChangeset for help on using the changeset viewer.