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/parser.h" | 5 #include "src/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 } else { | 3320 } else { |
3321 stmt->Initialize(each, subject, body); | 3321 stmt->Initialize(each, subject, body); |
3322 } | 3322 } |
3323 } | 3323 } |
3324 | 3324 |
3325 | 3325 |
3326 Statement* Parser::DesugarLexicalBindingsInForStatement( | 3326 Statement* Parser::DesugarLexicalBindingsInForStatement( |
3327 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, | 3327 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, |
3328 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 3328 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
3329 Statement* body, bool* ok) { | 3329 Statement* body, bool* ok) { |
3330 // ES6 13.6.3.4 specifies that on each loop iteration the let variables are | 3330 // ES6 13.7.4.8 specifies that on each loop iteration the let variables are |
3331 // copied into a new environment. After copying, the "next" statement of the | 3331 // copied into a new environment. After copying, the "next" statement of the |
3332 // loop is executed to update the loop variables. The loop condition is | 3332 // loop is executed to update the loop variables. The loop condition is |
3333 // checked and the loop body is executed. | 3333 // checked and the loop body is executed. |
3334 // | 3334 // |
3335 // We rewrite a for statement of the form | 3335 // We rewrite a for statement of the form |
3336 // | 3336 // |
3337 // labels: for (let/const x = i; cond; next) body | 3337 // labels: for (let/const x = i; cond; next) body |
3338 // | 3338 // |
3339 // into | 3339 // into |
3340 // | 3340 // |
(...skipping 16 matching lines...) Expand all Loading... |
3357 // } | 3357 // } |
3358 // flag = 1; | 3358 // flag = 1; |
3359 // } | 3359 // } |
3360 // labels: for (; flag == 1; flag = 0, temp_x = x) { | 3360 // labels: for (; flag == 1; flag = 0, temp_x = x) { |
3361 // if (cond) { | 3361 // if (cond) { |
3362 // body | 3362 // body |
3363 // } else { | 3363 // } else { |
3364 // break outer; | 3364 // break outer; |
3365 // } | 3365 // } |
3366 // } | 3366 // } |
3367 // if (flag == 1) { | 3367 // if (flag == 1) { // Body used break. |
3368 // break; | 3368 // break; |
3369 // } | 3369 // } |
3370 // } | 3370 // } |
3371 // } | 3371 // } |
3372 | 3372 |
3373 DCHECK(names->length() > 0); | 3373 DCHECK(names->length() > 0); |
3374 Scope* for_scope = scope_; | 3374 Scope* for_scope = scope_; |
3375 ZoneList<Variable*> temps(names->length(), zone()); | 3375 ZoneList<Variable*> temps(names->length(), zone()); |
3376 | 3376 |
3377 Block* outer_block = factory()->NewBlock(NULL, names->length() + 3, false, | 3377 Block* outer_block = factory()->NewBlock(NULL, names->length() + 3, false, |
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6289 | 6289 |
6290 Expression* Parser::SpreadCallNew(Expression* function, | 6290 Expression* Parser::SpreadCallNew(Expression* function, |
6291 ZoneList<v8::internal::Expression*>* args, | 6291 ZoneList<v8::internal::Expression*>* args, |
6292 int pos) { | 6292 int pos) { |
6293 args->InsertAt(0, function, zone()); | 6293 args->InsertAt(0, function, zone()); |
6294 | 6294 |
6295 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6295 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
6296 } | 6296 } |
6297 } // namespace internal | 6297 } // namespace internal |
6298 } // namespace v8 | 6298 } // namespace v8 |
OLD | NEW |