Ignore:
Timestamp:
Jun 16, 2011, 6:47:25 PM (14 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=23611
Multiline Javascript comments cause incorrect parsing of following script.

Reviewed by Oliver Hunt.

From the spec:
"A MultiLineComment [is] simply discarded if it contains no line terminator,
but if a MultiLineComment contains one or more line terminators, then it is
replaced with a single line terminator, which becomes part of the stream of
inputs for the syntactic grammar."

This may result in behavioural changes, due to automatic semicolon insertion.

Source/JavaScriptCore:

  • parser/Lexer.cpp:

(JSC::Lexer::parseMultilineComment):

  • Set m_terminator is we see a line terminator in a multiline comment.

LayoutTests:

  • fast/js/multiline-comment-newline-expected.txt: Added.
  • fast/js/multiline-comment-newline.html: Added.
  • fast/js/script-tests/multiline-comment-newline.js: Added.

(shouldBeUndefined):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r88724 r89100  
    737737            return false;
    738738
    739         if (isLineTerminator(m_current))
     739        if (isLineTerminator(m_current)) {
    740740            shiftLineTerminator();
    741         else
     741            m_terminator = true;
     742        } else
    742743            shift();
    743744    }
Note: See TracChangeset for help on using the changeset viewer.