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

Unified Diff: src/parser.h

Issue 768203002: Simplify template literal raw string creation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add harmony unicode test 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/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 4d60272497cebbb264aec0de1794fbd1603b75ed..58ef47acac34b1931fe0296ab949bf76626e4862 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -593,20 +593,18 @@ class ParserTraits {
class TemplateLiteral : public ZoneObject {
public:
TemplateLiteral(Zone* zone, int pos)
- : cooked_(8, zone),
- lengths_(8, zone),
- expressions_(8, zone),
- pos_(pos) {}
+ : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {}
const ZoneList<Expression*>* cooked() const { return &cooked_; }
- const ZoneList<int>* lengths() const { return &lengths_; }
+ const ZoneList<Expression*>* raw() const { return &raw_; }
const ZoneList<Expression*>* expressions() const { return &expressions_; }
int position() const { return pos_; }
- void AddTemplateSpan(Literal* cooked, int end, Zone* zone) {
+ void AddTemplateSpan(Literal* cooked, Literal* raw, int end, Zone* zone) {
DCHECK_NOT_NULL(cooked);
+ DCHECK_NOT_NULL(raw);
cooked_.Add(cooked, zone);
- lengths_.Add(end - cooked->position(), zone);
+ raw_.Add(raw, zone);
}
void AddExpression(Expression* expression, Zone* zone) {
@@ -616,7 +614,7 @@ class ParserTraits {
private:
ZoneList<Expression*> cooked_;
- ZoneList<int> lengths_;
+ ZoneList<Expression*> raw_;
ZoneList<Expression*> expressions_;
int pos_;
};
@@ -884,8 +882,8 @@ class Parser : public ParserBase<ParserTraits> {
Expression* expression);
Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start,
Expression* tag);
- ZoneList<Expression*>* TemplateRawStrings(const TemplateLiteral* lit,
- uint32_t* hash);
+ uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit);
+
Scanner scanner_;
PreParser* reusable_preparser_;
Scope* original_scope_; // for ES5 function declarations in sloppy eval
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698