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

Unified Diff: src/parsing/pattern-rewriter.cc

Issue 1542813003: [debugger] step on every assignment in destructuring bind. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix: only emit statement positions for subpatterns Created 5 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 | « src/parsing/parser.h ('k') | test/mjsunit/harmony/debug-step-destructuring-bind.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/pattern-rewriter.cc
diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc
index a1b060031bfde40ce06c575a47bafddd515d9bb0..6e20282785d0ba3495b2b4b723f69cb6e861bfd6 100644
--- a/src/parsing/pattern-rewriter.cc
+++ b/src/parsing/pattern-rewriter.cc
@@ -26,6 +26,7 @@ void Parser::PatternRewriter::DeclareAndInitializeVariables(
rewriter.descriptor_ = declaration_descriptor;
rewriter.names_ = names;
rewriter.ok_ = ok;
+ rewriter.recursion_level_ = 0;
rewriter.RecurseIntoSubpattern(rewriter.pattern_, declaration->initializer);
}
@@ -46,6 +47,7 @@ void Parser::PatternRewriter::RewriteDestructuringAssignment(
rewriter.descriptor_ = nullptr;
rewriter.names_ = nullptr;
rewriter.ok_ = &ok;
+ rewriter.recursion_level_ = 0;
rewriter.RecurseIntoSubpattern(rewriter.pattern_, nullptr);
DCHECK(ok);
@@ -280,11 +282,12 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
DCHECK_NOT_NULL(proxy);
DCHECK_NOT_NULL(proxy->var());
DCHECK_NOT_NULL(value);
- Assignment* assignment = factory()->NewAssignment(
- Token::INIT, proxy, value, descriptor_->initialization_pos);
+ // Add break location for destructured sub-pattern.
+ int pos = IsSubPattern() ? pattern->position() : RelocInfo::kNoPosition;
+ Assignment* assignment =
+ factory()->NewAssignment(Token::INIT, proxy, value, pos);
block_->statements()->Add(
- factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition),
- zone());
+ factory()->NewExpressionStatement(assignment, pos), zone());
value = NULL;
}
@@ -296,11 +299,12 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
// if they are inside a 'with' statement - they may change a 'with' object
// property).
VariableProxy* proxy = initialization_scope->NewUnresolved(factory(), name);
- Assignment* assignment = factory()->NewAssignment(
- Token::INIT, proxy, value, descriptor_->initialization_pos);
+ // Add break location for destructured sub-pattern.
+ int pos = IsSubPattern() ? pattern->position() : RelocInfo::kNoPosition;
+ Assignment* assignment =
+ factory()->NewAssignment(Token::INIT, proxy, value, pos);
block_->statements()->Add(
- factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition),
- zone());
+ factory()->NewExpressionStatement(assignment, pos), zone());
}
}
« no previous file with comments | « src/parsing/parser.h ('k') | test/mjsunit/harmony/debug-step-destructuring-bind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698