| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/rewriter.h" | 7 #include "src/rewriter.h" |
| 8 | 8 |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 if (processor.result_assigned()) { | 247 if (processor.result_assigned()) { |
| 248 DCHECK(function->end_position() != RelocInfo::kNoPosition); | 248 DCHECK(function->end_position() != RelocInfo::kNoPosition); |
| 249 // Set the position of the assignment statement one character past the | 249 // Set the position of the assignment statement one character past the |
| 250 // source code, such that it definitely is not in the source code range | 250 // source code, such that it definitely is not in the source code range |
| 251 // of an immediate inner scope. For example in | 251 // of an immediate inner scope. For example in |
| 252 // eval('with ({x:1}) x = 1'); | 252 // eval('with ({x:1}) x = 1'); |
| 253 // the end position of the function generated for executing the eval code | 253 // the end position of the function generated for executing the eval code |
| 254 // coincides with the end of the with scope which is the position of '1'. | 254 // coincides with the end of the with scope which is the position of '1'. |
| 255 int pos = function->end_position(); | 255 int pos = function->end_position(); |
| 256 VariableProxy* result_proxy = processor.factory()->NewVariableProxy( | 256 VariableProxy* result_proxy = |
| 257 result->raw_name(), false, result->interface(), pos); | 257 processor.factory()->NewVariableProxy(result, pos); |
| 258 result_proxy->BindTo(result); | |
| 259 Statement* result_statement = | 258 Statement* result_statement = |
| 260 processor.factory()->NewReturnStatement(result_proxy, pos); | 259 processor.factory()->NewReturnStatement(result_proxy, pos); |
| 261 body->Add(result_statement, info->zone()); | 260 body->Add(result_statement, info->zone()); |
| 262 } | 261 } |
| 263 } | 262 } |
| 264 | 263 |
| 265 return true; | 264 return true; |
| 266 } | 265 } |
| 267 | 266 |
| 268 | 267 |
| 269 } } // namespace v8::internal | 268 } } // namespace v8::internal |
| OLD | NEW |