Skip to content
  • mjs's avatar
    JavaScriptCore: · a8a255be
    mjs authored
            Reviewed by Darin(first pass) and Hyatt.
    
            - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3576
            (roll in support for "const" keyword from KDE tree)
            - make processVarDecls handle deletability of variables declared
            in an eval block the same as evaluate would
            - make eval() call processVarDecls - needed to match mozilla and
            to make the second change testable
    
            I started with the KDE implementation of const but I ended up changing it a bit
            to avoid the use of a global variable. Now instead of the global variable it distinguishes
            const and var at the grammar level so the appropriate node can know the right kind of
            declaration.
    
            Test cases:
            * tests/mozilla/expected.html: Updated for one new test that is
            failing - we used to bail on it entirely because it checks for
            const support before starting.
            - see also test cases added in WebCore
    
            * kjs/grammar.y: Add rules for const declarations.
            * kjs/keywords.table: Add const keyword.
            * kjs/nodes.cpp:
            (VarDeclNode::VarDeclNode): Add parameter.
            (VarDeclNode::evaluate): Add const support.
            (VarDeclNode::processVarDecls): Add const support.
            (VarStatementNode::execute): Irrelevant change.
            (ForInNode::ForInNode): Tell our variable node that it's a variable.
            * kjs/nodes.h:
            (KJS::VarDeclNode::): Add declaration of type enum, extra constructor parameter.
            (KJS::VarStatementNode::VarStatementNode): Irrelevant change.
            * kjs/function.cpp:
            (KJS::GlobalFuncImp::call): Process var decls before evaluating.
    
    WebCore:
    
            Reviewed by Darin(first pass) and Hyatt.
    
            - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3576
            (roll in support for "const" keyword from KDE tree)
            - make processVarDecls handle deletability of variables declared
            in an eval block the same as evaluate would
            - make eval() call processVarDecls - needed to match mozilla and
            to make the second change testable
    
    	Test cases only, fix is in JavaScriptCore
    
            Test cases added:
            * layout-tests/fast/js/const-expected.txt: Added.
            * layout-tests/fast/js/const.html: Added.
            * layout-tests/fast/js/eval-var-decl-expected.txt: Added.
            * layout-tests/fast/js/eval-var-decl.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@9445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a8a255be