Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1432)

Unified Diff: src/scanner-base.cc

Issue 7184034: Make line-terminators inside multi-line comments count. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-892742.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-892742.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698