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

Unified Diff: src/scanner.cc

Issue 812163003: Simplify scanner and generate better error message for legacy octals in templates (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase it Created 6 years 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 | « src/preparser.cc ('k') | test/mjsunit/harmony/templates.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index 7cd0895cb3ddb47169b88ed8c1ddf83c3ed4c2a5..d499e9b996dbbf0e8c348e49b0ecb678431fbb13 100644
--- a/src/scanner.cc
+++ b/src/scanner.cc
@@ -733,21 +733,7 @@ bool Scanner::ScanEscape() {
if (c < 0) return false;
break;
}
- case '0':
- if (in_template_literal) {
- // \ 0 DecimalDigit is never allowed in templates.
- if (IsDecimalDigit(c0_)) {
- Advance<capture_raw>(); // Advance to include the problematic char.
- return false;
- }
-
- // The TV of TemplateCharacter :: \ EscapeSequence is the CV of
- // EscapeSequence.
- // The CV of EscapeSequence :: 0 is the code unit value 0.
- c = 0;
- break;
- }
- // Fall through.
+ case '0': // Fall through.
case '1': // fall through
case '2': // fall through
case '3': // fall through
@@ -755,14 +741,8 @@ bool Scanner::ScanEscape() {
case '5': // fall through
case '6': // fall through
case '7':
- if (!in_template_literal) {
- c = ScanOctalEscape<capture_raw>(c, 2);
- break;
- }
- // Fall through
- case '8':
- case '9':
- if (in_template_literal) return false;
+ c = ScanOctalEscape<capture_raw>(c, 2);
+ break;
}
// According to ECMA-262, section 7.8.4, characters not covered by the
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/harmony/templates.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698