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

Unified Diff: src/preparser.h

Issue 1328083002: [es6] support `get` and `set` in shorthand properties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Alternate version using GOTO, take your pick? Created 5 years, 3 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/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 4f710fb65a7301543da44fa206300506d9afd255..91f4ffc79517ffec2571eaf15442c55c1056007c 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -2656,10 +2656,16 @@ ParserBase<Traits>::ParsePropertyDefinition(
return ParsePropertyDefinition(checker, true, has_extends, true,
is_computed_name, nullptr, classifier, ok);
} else if (is_get || is_set) {
+ name_token = peek();
+ if (!in_class &&
+ (name_token == Token::ASSIGN || name_token == Token::COMMA ||
+ name_token == Token::RBRACE)) {
+ goto shorthand_property;
adamk 2015/09/08 23:17:17 Can't you just do without the goto? } else if ((i
caitp (gmail) 2015/09/08 23:35:13 That's true. I think this is still a confusing hac
+ }
+
// Accessor
name = this->EmptyIdentifier();
bool dont_care = false;
- name_token = peek();
name_expression = ParsePropertyName(
&name, &dont_care, &dont_care, &dont_care, is_computed_name, classifier,
@@ -2694,6 +2700,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
} else if (!in_class && Token::IsIdentifier(name_token, language_mode(),
this->is_generator())) {
+ shorthand_property:
DCHECK(!*is_computed_name);
DCHECK(!is_static);
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698