Chromium Code Reviews| 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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1884 // let/const/var x; | 1884 // let/const/var x; |
| 1885 // x = x'; | 1885 // x = x'; |
| 1886 // b; | 1886 // b; |
| 1887 // } | 1887 // } |
| 1888 // let x; // for TDZ | 1888 // let x; // for TDZ |
| 1889 // } | 1889 // } |
| 1890 void Parser::DesugarBindingInForEachStatement(ForInfo* for_info, | 1890 void Parser::DesugarBindingInForEachStatement(ForInfo* for_info, |
| 1891 Block** body_block, | 1891 Block** body_block, |
| 1892 Expression** each_variable, | 1892 Expression** each_variable, |
| 1893 bool* ok) { | 1893 bool* ok) { |
| 1894 DCHECK(for_info->parsing_result.declarations.length() == 1); | |
|
marja
2017/01/06 15:44:29
Unrelated to this CL, but makes sense to add this.
| |
| 1894 DeclarationParsingResult::Declaration& decl = | 1895 DeclarationParsingResult::Declaration& decl = |
| 1895 for_info->parsing_result.declarations[0]; | 1896 for_info->parsing_result.declarations[0]; |
| 1896 Variable* temp = NewTemporary(ast_value_factory()->dot_for_string()); | 1897 Variable* temp = NewTemporary(ast_value_factory()->dot_for_string()); |
| 1897 auto each_initialization_block = | 1898 auto each_initialization_block = |
| 1898 factory()->NewBlock(nullptr, 1, true, kNoSourcePosition); | 1899 factory()->NewBlock(nullptr, 1, true, kNoSourcePosition); |
| 1899 { | 1900 { |
| 1900 auto descriptor = for_info->parsing_result.descriptor; | 1901 auto descriptor = for_info->parsing_result.descriptor; |
| 1901 descriptor.declaration_pos = kNoSourcePosition; | 1902 descriptor.declaration_pos = kNoSourcePosition; |
| 1902 descriptor.initialization_pos = kNoSourcePosition; | 1903 descriptor.initialization_pos = kNoSourcePosition; |
| 1903 decl.initializer = factory()->NewVariableProxy(temp); | 1904 decl.initializer = factory()->NewVariableProxy(temp); |
| (...skipping 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5130 | 5131 |
| 5131 return final_loop; | 5132 return final_loop; |
| 5132 } | 5133 } |
| 5133 | 5134 |
| 5134 #undef CHECK_OK | 5135 #undef CHECK_OK |
| 5135 #undef CHECK_OK_VOID | 5136 #undef CHECK_OK_VOID |
| 5136 #undef CHECK_FAILED | 5137 #undef CHECK_FAILED |
| 5137 | 5138 |
| 5138 } // namespace internal | 5139 } // namespace internal |
| 5139 } // namespace v8 | 5140 } // namespace v8 |
| OLD | NEW |