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

Unified Diff: src/ast.h

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
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/ast.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index d57aaa85b9147fb69b56cfd3de4944009b88597f..7a0d72f8d8c4fbc8f500d4631b1dcf7818e08265 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1483,10 +1483,7 @@ class ObjectLiteralProperty FINAL : public ZoneObject {
PROTOTYPE // Property is __proto__.
};
- ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory,
- Literal* key, Expression* value, bool is_static);
-
- Literal* key() { return key_; }
+ Expression* key() { return key_; }
Expression* value() { return value_; }
Kind kind() { return kind_; }
@@ -1501,20 +1498,26 @@ class ObjectLiteralProperty FINAL : public ZoneObject {
bool emit_store();
bool is_static() const { return is_static_; }
+ bool is_computed_name() const { return is_computed_name_; }
protected:
friend class AstNodeFactory;
- ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value,
- bool is_static);
- void set_key(Literal* key) { key_ = key; }
+ ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory,
+ Expression* key, Expression* value, bool is_static,
+ bool is_computed_name);
+
+ ObjectLiteralProperty(Zone* zone, bool is_getter, Expression* key,
+ FunctionLiteral* value, bool is_static,
+ bool is_computed_name);
private:
- Literal* key_;
+ Expression* key_;
Expression* value_;
Kind kind_;
bool emit_store_;
bool is_static_;
+ bool is_computed_name_;
arv (Not doing code reviews) 2014/12/10 23:38:13 Another Kind would not work since computed can be
Handle<Map> receiver_type_;
};
@@ -3412,20 +3415,22 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
boilerplate_properties, has_function, pos);
}
- ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key,
+ ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key,
Expression* value,
- bool is_static) {
+ bool is_static,
+ bool is_computed_name) {
return new (zone_) ObjectLiteral::Property(zone_, ast_value_factory_, key,
- value, is_static);
+ value, is_static,
+ is_computed_name);
}
ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
+ Expression* key,
FunctionLiteral* value,
- int pos, bool is_static) {
- ObjectLiteral::Property* prop =
- new (zone_) ObjectLiteral::Property(zone_, is_getter, value, is_static);
- prop->set_key(NewStringLiteral(value->raw_name(), pos));
- return prop;
+ int pos, bool is_static,
+ bool is_computed_name) {
+ return new (zone_) ObjectLiteral::Property(zone_, is_getter, key, value,
+ is_static, is_computed_name);
}
RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern,
« no previous file with comments | « no previous file | src/ast.cc » ('j') | src/ast.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698