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

Unified Diff: src/parser.cc

Issue 663683006: Implement ES6 Template Literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 5c85b97ba655848215c623222509fc4528ea1b31..94725e1ffbbcf9cb5479467012822416873b9026 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -758,6 +758,7 @@ Parser::Parser(CompilationInfo* info, ParseInfo* parse_info)
set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
set_allow_classes(FLAG_harmony_classes);
set_allow_harmony_object_literals(FLAG_harmony_object_literals);
+ set_allow_harmony_templates(FLAG_harmony_templates);
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
++feature) {
use_counts_[feature] = 0;
@@ -4967,4 +4968,33 @@ void Parser::ParseOnBackground() {
log_ = NULL;
}
}
+
+
+void Parser::AddTemplateSpan(TemplateLiteralState* state) {
+ // TODO: Make this work properly...
+ /*if (!state->spans_) {
+ state->spans_ = new (zone()) ZoneList<const AstTemplateSpan*>(8, zone());
+ }
+ const AstRawString* tv = scanner()->CurrentSymbol(ast_value_factory());
+ const AstRawString* trv = scanner()->CurrentRawSymbol(ast_value_factory());
+ const AstTemplateSpan* span = ast_value_factory()->NewTemplateSpan(tv, trv);
+ state->spans_->Add(span, zone());*/
+}
+
+void Parser::AddTemplateExpression(TemplateLiteralState* state,
+ Expression* expression) {
+ // TODO: Make this work properly...
+ /*if (!state->expressions_) {
+ state->expressions_ = new(zone()) ZoneList<Expression*>(8, zone());
+ }
+ state->expressions_->Add(expression, zone());*/
+}
+
+Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int pos) {
+ Expression* lit =
+ factory()->NewTemplateLiteral(state->spans_, state->expressions_, pos);
+ state->expressions_ = NULL;
+ state->spans_ = NULL;
+ return lit;
+}
} } // namespace v8::internal

Powered by Google App Engine
This is Rietveld 408576698