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

Unified Diff: src/rewriter.cc

Issue 8725001: Reapply "Fix the ScopeIterator reimplementation". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use BreakLocationIterator to discover break at return. Created 9 years, 1 month 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
« src/parser.cc ('K') | « src/parser.cc ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/rewriter.cc
diff --git a/src/rewriter.cc b/src/rewriter.cc
index 3d4c2dcc126a8129d26a2376bfdb2fffb38b7da8..a70cd82a72ee115a6e768d95e33f922746af6667 100644
--- a/src/rewriter.cc
+++ b/src/rewriter.cc
@@ -236,10 +236,22 @@ bool Rewriter::Rewrite(CompilationInfo* info) {
if (processor.HasStackOverflow()) return false;
if (processor.result_assigned()) {
+ ASSERT(function->end_position() != RelocInfo::kNoPosition);
Isolate* isolate = info->isolate();
Zone* zone = isolate->zone();
- VariableProxy* result_proxy = new(zone) VariableProxy(isolate, result);
- body->Add(new(zone) ReturnStatement(result_proxy));
+ // Set the position of the assignment statement one character past the
+ // source code, such that it definitely is not in the source code range
+ // of an immediate inner scope. For example in
+ // eval('with ({x:1}) x = 1');
+ // the end position of the function generated for executing the eval code
+ // coincides with the end of the with scope which is the position of '1'.
+ int position = function->end_position();
+ VariableProxy* result_proxy = new(zone) VariableProxy(
+ isolate, result->name(), false, position);
+ result_proxy->BindTo(result);
+ Statement* result_statement = new(zone) ReturnStatement(result_proxy);
+ result_statement->set_statement_pos(position);
+ body->Add(result_statement);
}
}
« src/parser.cc ('K') | « src/parser.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698