Index: src/scanner-base.cc |
diff --git a/src/scanner-base.cc b/src/scanner-base.cc |
index e15ef416c9c4a8201bfc134db0a73f7928e565b4..0e10191fe9b15489f9c1d7241ddc16fe4c28ff5f 100644 |
--- a/src/scanner-base.cc |
+++ b/src/scanner-base.cc |
@@ -144,7 +144,7 @@ Token::Value JavaScriptScanner::SkipSingleLineComment() { |
// to be part of the single-line comment; it is recognized |
// separately by the lexical grammar and becomes part of the |
// stream of input elements for the syntactic grammar (see |
- // ECMA-262, section 7.4, page 12). |
+ // ECMA-262, section 7.4). |
while (c0_ >= 0 && !unicode_cache_->IsLineTerminator(c0_)) { |
Advance(); |
} |
@@ -160,13 +160,14 @@ Token::Value JavaScriptScanner::SkipMultiLineComment() { |
while (c0_ >= 0) { |
char ch = c0_; |
Advance(); |
+ if (unicode_cache_->IsLineTerminator(ch)) { |
+ // Following ECMA-262, section 7.4, a comment containing |
+ // a newline will make the comment count as a line-terminator. |
+ has_line_terminator_before_next_ = true; |
+ } |
// If we have reached the end of the multi-line comment, we |
// consume the '/' and insert a whitespace. This way all |
- // multi-line comments are treated as whitespace - even the ones |
- // containing line terminators. This contradicts ECMA-262, section |
- // 7.4, page 12, that says that multi-line comments containing |
- // line terminators should be treated as a line terminator, but it |
- // matches the behaviour of SpiderMonkey and KJS. |
+ // multi-line comments are treated as whitespace. |
if (ch == '*' && c0_ == '/') { |
c0_ = ' '; |
return Token::WHITESPACE; |