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

Unified Diff: src/ast.h

Issue 332443002: Add support for computed property names in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added tests Created 6 years, 6 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 | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.cc » ('j') | src/preparser.h » ('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 0882b250ffde424f2f86925d1416c4fa54288f54..fb19e8e09bf98b2b58c048edc7b60f7607070875 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1447,12 +1447,14 @@ class ObjectLiteralProperty V8_FINAL : public ZoneObject {
COMPUTED, // Property with computed value (execution time).
MATERIALIZED_LITERAL, // Property value is a materialized literal.
GETTER, SETTER, // Property is an accessor function.
- PROTOTYPE // Property is __proto__.
+ PROTOTYPE, // Property is __proto__.
+ COMPUTED_NAME // Property with computed name.
};
- ObjectLiteralProperty(Zone* zone, Literal* key, Expression* value);
+ ObjectLiteralProperty(Zone* zone, Expression* key, Expression* value,
+ bool is_computed_name);
- Literal* key() { return key_; }
+ Expression* key() { return key_; }
Expression* value() { return value_; }
Kind kind() { return kind_; }
@@ -1470,10 +1472,10 @@ class ObjectLiteralProperty V8_FINAL : public ZoneObject {
template<class> friend class AstNodeFactory;
ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value);
- void set_key(Literal* key) { key_ = key; }
+ void set_key(Expression* key) { key_ = key; }
private:
- Literal* key_;
+ Expression* key_;
Expression* value_;
Kind kind_;
bool emit_store_;
@@ -3154,9 +3156,11 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
VISIT_AND_RETURN(ObjectLiteral, lit)
}
- ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key,
- Expression* value) {
- return new(zone_) ObjectLiteral::Property(zone_, key, value);
+ ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key,
+ Expression* value,
+ bool is_computed_name) {
+ return new(zone_) ObjectLiteral::Property(zone_, key, value,
+ is_computed_name);
}
ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.cc » ('j') | src/preparser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698