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 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 } | 1480 } |
1481 | 1481 |
1482 Statement* Parser::DeclareFunction(const AstRawString* variable_name, | 1482 Statement* Parser::DeclareFunction(const AstRawString* variable_name, |
1483 FunctionLiteral* function, VariableMode mode, | 1483 FunctionLiteral* function, VariableMode mode, |
1484 int pos, bool is_sloppy_block_function, | 1484 int pos, bool is_sloppy_block_function, |
1485 ZoneList<const AstRawString*>* names, | 1485 ZoneList<const AstRawString*>* names, |
1486 bool* ok) { | 1486 bool* ok) { |
1487 VariableProxy* proxy = | 1487 VariableProxy* proxy = |
1488 factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE); | 1488 factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE); |
1489 | 1489 |
1490 MarkTopLevelVariableAsAssigned(scope(), proxy); | |
1491 | |
1492 Declaration* declaration = | 1490 Declaration* declaration = |
1493 factory()->NewFunctionDeclaration(proxy, function, scope(), pos); | 1491 factory()->NewFunctionDeclaration(proxy, function, scope(), pos); |
1494 Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized, | 1492 Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized, |
1495 CHECK_OK); | 1493 CHECK_OK); |
1496 if (names) names->Add(variable_name, zone()); | 1494 if (names) names->Add(variable_name, zone()); |
1497 if (is_sloppy_block_function) { | 1495 if (is_sloppy_block_function) { |
1498 SloppyBlockFunctionStatement* statement = | 1496 SloppyBlockFunctionStatement* statement = |
1499 factory()->NewSloppyBlockFunctionStatement(); | 1497 factory()->NewSloppyBlockFunctionStatement(); |
1500 GetDeclarationScope()->DeclareSloppyBlockFunction(variable_name, scope(), | 1498 GetDeclarationScope()->DeclareSloppyBlockFunction(variable_name, scope(), |
1501 statement); | 1499 statement); |
(...skipping 3524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5026 | 5024 |
5027 return final_loop; | 5025 return final_loop; |
5028 } | 5026 } |
5029 | 5027 |
5030 #undef CHECK_OK | 5028 #undef CHECK_OK |
5031 #undef CHECK_OK_VOID | 5029 #undef CHECK_OK_VOID |
5032 #undef CHECK_FAILED | 5030 #undef CHECK_FAILED |
5033 | 5031 |
5034 } // namespace internal | 5032 } // namespace internal |
5035 } // namespace v8 | 5033 } // namespace v8 |
OLD | NEW |