Ignore:
Timestamp:
Sep 6, 2012, 6:42:53 PM (13 years ago)
Author:
[email protected]
Message:

Source/JavaScriptCore: Rolled back in <http://trac.webkit.org/changeset/127698> with a fix for
fast/dom/HTMLScriptElement/script-reexecution-pretty-diff.html, which
is to make sure that function declarations don't put their names in scope.

Reviewed by Gavin Barraclough.

Named functions should not allocate scope objects for their names
https://bugs.webkit.org/show_bug.cgi?id=95659

Reviewed by Oliver Hunt.

LayoutTests: Rolled back in <http://trac.webkit.org/changeset/127698> with a fix for
fast/dom/HTMLScriptElement/script-reexecution-pretty-diff.html.

Added a more explicit test for the feature I broke in
fast/dom/HTMLScriptElement/script-reexecution-pretty-diff.html.

Reviewed by Gavin Barraclough.

Named functions should not allocate scope objects for their names
https://bugs.webkit.org/show_bug.cgi?id=95659

Reviewed by Oliver Hunt.

  • fast/dom/HTMLScriptElement/script-reexecution.html:
  • fast/js/function-name-is-in-scope-expected.txt: Added.
  • fast/js/function-name-is-in-scope.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r127774 r127810  
    209209    bool isFunctionBoundary() { return m_isFunctionBoundary; }
    210210
     211    void declareCallee(const Identifier* ident)
     212    {
     213        m_declaredVariables.add(ident->ustring().impl());
     214    }
     215
    211216    bool declareVariable(const Identifier* ident)
    212217    {
     
    383388
    384389public:
    385     Parser(JSGlobalData*, const SourceCode&, FunctionParameters*, JSParserStrictness, JSParserMode);
     390    Parser(JSGlobalData*, const SourceCode&, FunctionParameters*, const Identifier&, JSParserStrictness, JSParserMode);
    386391    ~Parser();
    387392
     
    10211026
    10221027template <class ParsedNode>
    1023 PassRefPtr<ParsedNode> parse(JSGlobalData* globalData, JSGlobalObject* lexicalGlobalObject, const SourceCode& source, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode parserMode, Debugger* debugger, ExecState* execState, JSObject** exception)
     1028PassRefPtr<ParsedNode> parse(JSGlobalData* globalData, JSGlobalObject* lexicalGlobalObject, const SourceCode& source, FunctionParameters* parameters, const Identifier& name, JSParserStrictness strictness, JSParserMode parserMode, Debugger* debugger, ExecState* execState, JSObject** exception)
    10241029{
    10251030    SamplingRegion samplingRegion("Parsing");
     
    10281033
    10291034    if (source.provider()->data()->is8Bit()) {
    1030         Parser< Lexer<LChar> > parser(globalData, source, parameters, strictness, parserMode);
     1035        Parser< Lexer<LChar> > parser(globalData, source, parameters, name, strictness, parserMode);
    10311036        return parser.parse<ParsedNode>(lexicalGlobalObject, debugger, execState, exception);
    10321037    }
    1033     Parser< Lexer<UChar> > parser(globalData, source, parameters, strictness, parserMode);
     1038    Parser< Lexer<UChar> > parser(globalData, source, parameters, name, strictness, parserMode);
    10341039    return parser.parse<ParsedNode>(lexicalGlobalObject, debugger, execState, exception);
    10351040}
Note: See TracChangeset for help on using the changeset viewer.