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

Unified Diff: src/scanner-base.cc

Issue 7218009: Make multi-line comments not count when checking whether --> is first on a line. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Changed logic as suggested. 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
Index: src/scanner-base.cc
diff --git a/src/scanner-base.cc b/src/scanner-base.cc
index 89591baa243e003247e44ae4145b819590b8efce..262f4edd8f868b6680eaa826a3f0575c36ad0da5 100644
--- a/src/scanner-base.cc
+++ b/src/scanner-base.cc
@@ -80,6 +80,7 @@ JavaScriptScanner::JavaScriptScanner(UnicodeCache* scanner_contants)
Token::Value JavaScriptScanner::Next() {
current_ = next_;
has_line_terminator_before_next_ = false;
+ has_multiline_comment_before_next_ = false;
Scan();
return current_.token;
}
@@ -163,11 +164,13 @@ Token::Value JavaScriptScanner::SkipMultiLineComment() {
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;
+ has_multiline_comment_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.
+ // multi-line comments are treated as whitespace (except
+ // when checking whether there is non-whitespace before a
William Hesse 2011/06/21 12:38:54 This addition is wrong. They are treated as white
Lasse Reichstein 2011/06/21 13:05:37 Fixed.
+ // --> comment).
if (ch == '*' && c0_ == '/') {
c0_ = ' ';
return Token::WHITESPACE;
@@ -449,6 +452,7 @@ void JavaScriptScanner::SeekForward(int pos) {
// of the end of a function (at the "}" token). It doesn't matter
// whether there was a line terminator in the part we skip.
has_line_terminator_before_next_ = false;
+ has_multiline_comment_before_next_ = false;
}
Scan();
}
« src/scanner-base.h ('K') | « src/scanner-base.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698