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

Unified Diff: src/parser.cc

Issue 1032653002: Do not assign positions to parser-generated desugarings. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased for landing Created 5 years, 9 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/hydrogen.h ('k') | test/mjsunit/es6/regress/regress-468661.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index afe51b2882c5ad3d6202590638d51da90d84f07f..8ed20ee2121cfec8d313b042ac5ea878e66be628 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -3201,7 +3201,6 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
Block* inner_block = factory()->NewBlock(NULL, names->length() + 4, false,
RelocInfo::kNoPosition);
- int pos = scanner()->location().beg_pos;
ZoneList<Variable*> inner_vars(names->length(), zone());
// For each let variable x:
@@ -3214,8 +3213,9 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
Declare(declaration, true, CHECK_OK);
inner_vars.Add(declaration->proxy()->var(), zone());
VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i));
- Assignment* assignment = factory()->NewAssignment(
- is_const ? Token::INIT_CONST : Token::INIT_LET, proxy, temp_proxy, pos);
+ Assignment* assignment =
+ factory()->NewAssignment(is_const ? Token::INIT_CONST : Token::INIT_LET,
+ proxy, temp_proxy, RelocInfo::kNoPosition);
Statement* assignment_statement =
factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition);
proxy->var()->set_initializer_position(init->position());
@@ -3230,8 +3230,8 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
{
Expression* const1 = factory()->NewSmiLiteral(1, RelocInfo::kNoPosition);
VariableProxy* first_proxy = factory()->NewVariableProxy(first);
- compare =
- factory()->NewCompareOperation(Token::EQ, first_proxy, const1, pos);
+ compare = factory()->NewCompareOperation(Token::EQ, first_proxy, const1,
+ RelocInfo::kNoPosition);
}
Statement* clear_first = NULL;
// Make statement: first = 0.
@@ -3243,8 +3243,8 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
clear_first =
factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition);
}
- Statement* clear_first_or_next = factory()->NewIfStatement(
- compare, clear_first, next, RelocInfo::kNoPosition);
+ Statement* clear_first_or_next =
+ factory()->NewIfStatement(compare, clear_first, next, next->position());
inner_block->AddStatement(clear_first_or_next, zone());
}
@@ -3265,8 +3265,8 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
{
Expression* const1 = factory()->NewSmiLiteral(1, RelocInfo::kNoPosition);
VariableProxy* flag_proxy = factory()->NewVariableProxy(flag);
- flag_cond =
- factory()->NewCompareOperation(Token::EQ, flag_proxy, const1, pos);
+ flag_cond = factory()->NewCompareOperation(Token::EQ, flag_proxy, const1,
+ RelocInfo::kNoPosition);
}
// Create chain of expressions "flag = 0, temp_x = x, ..."
@@ -3282,9 +3282,11 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
}
// Make the comma-separated list of temp_x = x assignments.
+ int inner_var_proxy_pos = scanner()->location().beg_pos;
for (int i = 0; i < names->length(); i++) {
VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i));
- VariableProxy* proxy = factory()->NewVariableProxy(inner_vars.at(i), pos);
+ VariableProxy* proxy =
+ factory()->NewVariableProxy(inner_vars.at(i), inner_var_proxy_pos);
Assignment* assignment = factory()->NewAssignment(
Token::ASSIGN, temp_proxy, proxy, RelocInfo::kNoPosition);
compound_next = factory()->NewBinaryOperation(
@@ -3318,8 +3320,8 @@ Statement* Parser::DesugarLexicalBindingsInForStatement(
{
Expression* const1 = factory()->NewSmiLiteral(1, RelocInfo::kNoPosition);
VariableProxy* flag_proxy = factory()->NewVariableProxy(flag);
- compare =
- factory()->NewCompareOperation(Token::EQ, flag_proxy, const1, pos);
+ compare = factory()->NewCompareOperation(Token::EQ, flag_proxy, const1,
+ RelocInfo::kNoPosition);
}
Statement* stop =
factory()->NewBreakStatement(outer_loop, RelocInfo::kNoPosition);
« no previous file with comments | « src/hydrogen.h ('k') | test/mjsunit/es6/regress/regress-468661.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698