| 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 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 Statement* Parser::DeclareFunction(const AstRawString* variable_name, | 1475 Statement* Parser::DeclareFunction(const AstRawString* variable_name, |
| 1476 FunctionLiteral* function, VariableMode mode, | 1476 FunctionLiteral* function, VariableMode mode, |
| 1477 int pos, bool is_generator, bool is_async, | 1477 int pos, bool is_generator, bool is_async, |
| 1478 bool is_sloppy_block_function, | 1478 bool is_sloppy_block_function, |
| 1479 ZoneList<const AstRawString*>* names, | 1479 ZoneList<const AstRawString*>* names, |
| 1480 bool* ok) { | 1480 bool* ok) { |
| 1481 VariableProxy* proxy = | 1481 VariableProxy* proxy = |
| 1482 factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE); | 1482 factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE); |
| 1483 |
| 1484 DeclarationScope* target_scope = GetDeclarationScope(); |
| 1485 MarkTopLevelVariableAsAssigned(target_scope, proxy); |
| 1486 |
| 1483 Declaration* declaration = | 1487 Declaration* declaration = |
| 1484 factory()->NewFunctionDeclaration(proxy, function, scope(), pos); | 1488 factory()->NewFunctionDeclaration(proxy, function, scope(), pos); |
| 1485 Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized, | 1489 Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized, |
| 1486 CHECK_OK); | 1490 CHECK_OK); |
| 1487 if (names) names->Add(variable_name, zone()); | 1491 if (names) names->Add(variable_name, zone()); |
| 1488 if (is_sloppy_block_function) { | 1492 if (is_sloppy_block_function) { |
| 1489 SloppyBlockFunctionStatement* statement = | 1493 SloppyBlockFunctionStatement* statement = |
| 1490 factory()->NewSloppyBlockFunctionStatement(); | 1494 factory()->NewSloppyBlockFunctionStatement(); |
| 1491 DeclarationScope* target_scope = GetDeclarationScope(); | |
| 1492 target_scope->DeclareSloppyBlockFunction(variable_name, scope(), statement); | 1495 target_scope->DeclareSloppyBlockFunction(variable_name, scope(), statement); |
| 1493 return statement; | 1496 return statement; |
| 1494 } | 1497 } |
| 1495 return factory()->NewEmptyStatement(kNoSourcePosition); | 1498 return factory()->NewEmptyStatement(kNoSourcePosition); |
| 1496 } | 1499 } |
| 1497 | 1500 |
| 1498 Statement* Parser::DeclareClass(const AstRawString* variable_name, | 1501 Statement* Parser::DeclareClass(const AstRawString* variable_name, |
| 1499 Expression* value, | 1502 Expression* value, |
| 1500 ZoneList<const AstRawString*>* names, | 1503 ZoneList<const AstRawString*>* names, |
| 1501 int class_token_pos, int end_pos, bool* ok) { | 1504 int class_token_pos, int end_pos, bool* ok) { |
| (...skipping 3519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5021 | 5024 |
| 5022 return final_loop; | 5025 return final_loop; |
| 5023 } | 5026 } |
| 5024 | 5027 |
| 5025 #undef CHECK_OK | 5028 #undef CHECK_OK |
| 5026 #undef CHECK_OK_VOID | 5029 #undef CHECK_OK_VOID |
| 5027 #undef CHECK_FAILED | 5030 #undef CHECK_FAILED |
| 5028 | 5031 |
| 5029 } // namespace internal | 5032 } // namespace internal |
| 5030 } // namespace v8 | 5033 } // namespace v8 |
| OLD | NEW |