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

Unified Diff: src/ast.h

Issue 1225223004: Fix spread array inside array literal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add flag Created 5 years, 5 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 | src/ast.cc » ('j') | no next file with comments »
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 3a51982ec8bd2014ded90c86d8e13c2f27137823..b1a634edb4c7f02f4dc96658e3e9dba6c5cb9908 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1612,10 +1612,12 @@ class ArrayLiteral final : public MaterializedLiteral {
};
protected:
- ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, int literal_index,
- bool is_strong, int pos)
+ ArrayLiteral(Zone* zone, ZoneList<Expression*>* values,
+ int first_spread_index, int literal_index, bool is_strong,
+ int pos)
: MaterializedLiteral(zone, literal_index, is_strong, pos),
- values_(values) {}
+ values_(values),
+ first_spread_index_(first_spread_index) {}
static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
private:
@@ -1623,6 +1625,7 @@ class ArrayLiteral final : public MaterializedLiteral {
Handle<FixedArray> constant_elements_;
ZoneList<Expression*>* values_;
+ int first_spread_index_;
};
@@ -3452,8 +3455,15 @@ class AstNodeFactory final BASE_EMBEDDED {
int literal_index,
bool is_strong,
int pos) {
- return new (zone_) ArrayLiteral(zone_, values, literal_index, is_strong,
- pos);
+ return new (zone_)
+ ArrayLiteral(zone_, values, -1, literal_index, is_strong, pos);
+ }
+
+ ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
+ int first_spread_index, int literal_index,
+ bool is_strong, int pos) {
+ return new (zone_) ArrayLiteral(zone_, values, first_spread_index,
+ literal_index, is_strong, pos);
}
VariableProxy* NewVariableProxy(Variable* var,
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698