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

Unified Diff: src/parser.cc

Issue 795573005: ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 057b2e9eb2ef961bf296657ecfe5f25b4c9400a9..53e96f3f96a719dedb74c0c2a471a8886aa8939d 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -408,7 +408,7 @@ bool ParserTraits::IsThisProperty(Expression* expression) {
DCHECK(expression != NULL);
Property* property = expression->AsProperty();
return property != NULL &&
- property->obj()->AsVariableProxy() != NULL &&
+ property->obj()->IsVariableProxy() &&
property->obj()->AsVariableProxy()->is_this();
}
@@ -433,8 +433,7 @@ void ParserTraits::PushPropertyName(FuncNameInferrer* fni,
void ParserTraits::CheckAssigningFunctionLiteralToProperty(Expression* left,
Expression* right) {
DCHECK(left != NULL);
- if (left->AsProperty() != NULL &&
- right->AsFunctionLiteral() != NULL) {
+ if (left->IsProperty() && right->IsFunctionLiteral()) {
right->AsFunctionLiteral()->set_pretenure();
}
}
@@ -717,7 +716,6 @@ Literal* ParserTraits::ExpressionFromLiteral(Token::Value token, int pos,
Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name,
int pos, Scope* scope,
AstNodeFactory* factory) {
- if (parser_->fni_ != NULL) parser_->fni_->PushVariableName(name);
arv (Not doing code reviews) 2014/12/10 23:38:13 I can problably revert this now. I don't call thes
arv (Not doing code reviews) 2014/12/11 23:10:33 Done.
// The name may refer to a module instance object, so its type is unknown.
#ifdef DEBUG
if (FLAG_print_interface_details)
@@ -731,7 +729,6 @@ Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name,
Expression* ParserTraits::ExpressionFromString(int pos, Scanner* scanner,
AstNodeFactory* factory) {
const AstRawString* symbol = GetSymbol(scanner);
- if (parser_->fni_ != NULL) parser_->fni_->PushLiteralName(symbol);
return factory->NewStringLiteral(symbol, pos);
}
@@ -806,6 +803,8 @@ Parser::Parser(CompilationInfo* info, ParseInfo* parse_info)
set_allow_harmony_templates(FLAG_harmony_templates);
set_allow_harmony_sloppy(FLAG_harmony_sloppy);
set_allow_harmony_unicode(FLAG_harmony_unicode);
+ set_allow_harmony_computed_property_names(
+ FLAG_harmony_computed_property_names);
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
++feature) {
use_counts_[feature] = 0;
@@ -3976,6 +3975,8 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates());
reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy());
reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode());
+ reusable_preparser_->set_allow_harmony_computed_property_names(
+ allow_harmony_computed_property_names());
}
PreParser::PreParseResult result =
reusable_preparser_->PreParseLazyFunction(strict_mode(),
@@ -4035,8 +4036,10 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
if (fni_ != NULL) fni_->Enter();
const bool in_class = true;
const bool is_static = false;
+ bool is_computed_name = false;
Dmitry Lomov (no reviews) 2014/12/11 12:34:35 this should be has_seen_computed_name, right? Or w
arv (Not doing code reviews) 2014/12/11 23:10:33 Classes do not care about computed property name h
ObjectLiteral::Property* property = ParsePropertyDefinition(
- NULL, in_class, is_static, &has_seen_constructor, CHECK_OK);
+ NULL, in_class, is_static, &is_computed_name, &has_seen_constructor,
+ CHECK_OK);
if (has_seen_constructor && constructor == NULL) {
constructor = GetPropertyValue(property);

Powered by Google App Engine
This is Rietveld 408576698