| Index: src/ast.h
|
| diff --git a/src/ast.h b/src/ast.h
|
| index ae7ec1a659bf7bb70ae4faeeadc6763c8bef88a0..7f9b4f5d53da5f883d183181da2bb3a04f937098 100644
|
| --- a/src/ast.h
|
| +++ b/src/ast.h
|
| @@ -96,7 +96,8 @@ namespace internal {
|
| V(CompareOperation) \
|
| V(ThisFunction) \
|
| V(SuperReference) \
|
| - V(CaseClause)
|
| + V(CaseClause) \
|
| + V(TemplateLiteral)
|
|
|
| #define AST_NODE_LIST(V) \
|
| DECLARATION_NODE_LIST(V) \
|
| @@ -1432,6 +1433,46 @@ class Literal FINAL : public Expression {
|
| };
|
|
|
|
|
| +class TemplateLiteral FINAL : public Expression {
|
| + public:
|
| + DECLARE_NODE_TYPE(TemplateLiteral)
|
| +
|
| + const ZoneList<Expression*>* cooked() const { return &cooked_; }
|
| + const ZoneList<Expression*>* raw() const { return &raw_; }
|
| + const ZoneList<Expression*>* expressions() const { return &expressions_; }
|
| +
|
| + void AddTemplateSpan(Literal* cooked, Literal* raw, Zone* zone) {
|
| + DCHECK(cooked != NULL);
|
| + DCHECK(raw != NULL);
|
| + cooked_.Add(cooked, zone);
|
| + raw_.Add(raw, zone);
|
| + }
|
| +
|
| + void AddExpression(Expression* expression, Zone* zone) {
|
| + DCHECK(expression != NULL);
|
| + expressions_.Add(expression, zone);
|
| + }
|
| +
|
| + static int num_ids() { return parent_num_ids() + 1; }
|
| +
|
| + private:
|
| + TemplateLiteral(Zone* zone, int pos)
|
| + : Expression(zone, pos),
|
| + cooked_(8, zone),
|
| + raw_(8, zone),
|
| + expressions_(8, zone) {
|
| + }
|
| +
|
| + static int parent_num_ids() { return Expression::num_ids(); }
|
| +
|
| + int local_id(int n) const { return base_id() + parent_num_ids() + n; }
|
| +
|
| + ZoneList<Expression*> cooked_;
|
| + ZoneList<Expression*> raw_;
|
| + ZoneList<Expression*> expressions_;
|
| +};
|
| +
|
| +
|
| // Base class for literals that needs space in the corresponding JSFunction.
|
| class MaterializedLiteral : public Expression {
|
| public:
|
| @@ -3389,6 +3430,12 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
|
| VISIT_AND_RETURN(Literal, lit)
|
| }
|
|
|
| + TemplateLiteral* NewTemplateLiteral(int pos) {
|
| + TemplateLiteral* lit =
|
| + new (zone_) TemplateLiteral(zone_, pos);
|
| + VISIT_AND_RETURN(TemplateLiteral, lit);
|
| + }
|
| +
|
| // A JavaScript symbol (ECMA-262 edition 6).
|
| Literal* NewSymbolLiteral(const char* name, int pos) {
|
| Literal* lit =
|
|
|