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

Unified Diff: src/parsing/scanner.cc

Issue 1678303002: [es7] implement exponentiation operator proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/parsing/scanner.cc
diff --git a/src/parsing/scanner.cc b/src/parsing/scanner.cc
index 2d5a57958336ef1ec4bb65b8ce63da1efc199a3e..2b553645f299d96e5214b2071d2b1def6068a9c6 100644
--- a/src/parsing/scanner.cc
+++ b/src/parsing/scanner.cc
@@ -40,7 +40,8 @@ Scanner::Scanner(UnicodeCache* unicode_cache)
: unicode_cache_(unicode_cache),
bookmark_c0_(kNoBookmark),
octal_pos_(Location::invalid()),
- found_html_comment_(false) {
+ found_html_comment_(false),
+ allow_harmony_exponentiation_operator_(false) {
bookmark_current_.literal_chars = &bookmark_current_literal_;
bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_;
bookmark_next_.literal_chars = &bookmark_next_literal_;
@@ -565,7 +566,14 @@ void Scanner::Scan() {
case '*':
// * *=
- token = Select('=', Token::ASSIGN_MUL, Token::MUL);
+ Advance();
+ if (c0_ == '*' && allow_harmony_exponentiation_operator()) {
+ token = Select('=', Token::ASSIGN_EXP, Token::EXP);
+ } else if (c0_ == '=') {
+ token = Select(Token::ASSIGN_MUL);
+ } else {
+ token = Token::MUL;
+ }
break;
case '%':
« src/parsing/parser-base.h ('K') | « src/parsing/scanner.h ('k') | src/parsing/token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698