Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/parsing/parser.cc

Issue 2680443002: [parsing] Make maybe-assigned more precise for sloppy block functions. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_generator, bool is_async, 1484 int pos, bool is_generator, bool is_async,
1485 bool is_sloppy_block_function, 1485 bool is_sloppy_block_function,
1486 ZoneList<const AstRawString*>* names, 1486 ZoneList<const AstRawString*>* names,
1487 bool* ok) { 1487 bool* ok) {
1488 VariableProxy* proxy = 1488 VariableProxy* proxy =
1489 factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE); 1489 factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE);
1490 1490
1491 DeclarationScope* target_scope = GetDeclarationScope(); 1491 MarkTopLevelVariableAsAssigned(scope(), proxy);
1492 MarkTopLevelVariableAsAssigned(target_scope, proxy);
1493 1492
1494 Declaration* declaration = 1493 Declaration* declaration =
1495 factory()->NewFunctionDeclaration(proxy, function, scope(), pos); 1494 factory()->NewFunctionDeclaration(proxy, function, scope(), pos);
1496 Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized, 1495 Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized,
1497 CHECK_OK); 1496 CHECK_OK);
1498 if (names) names->Add(variable_name, zone()); 1497 if (names) names->Add(variable_name, zone());
1499 if (is_sloppy_block_function) { 1498 if (is_sloppy_block_function) {
1500 SloppyBlockFunctionStatement* statement = 1499 SloppyBlockFunctionStatement* statement =
1501 factory()->NewSloppyBlockFunctionStatement(); 1500 factory()->NewSloppyBlockFunctionStatement();
1502 target_scope->DeclareSloppyBlockFunction(variable_name, scope(), statement); 1501 GetDeclarationScope()->DeclareSloppyBlockFunction(variable_name, scope(),
1502 statement);
1503 return statement; 1503 return statement;
1504 } 1504 }
1505 return factory()->NewEmptyStatement(kNoSourcePosition); 1505 return factory()->NewEmptyStatement(kNoSourcePosition);
1506 } 1506 }
1507 1507
1508 Statement* Parser::DeclareClass(const AstRawString* variable_name, 1508 Statement* Parser::DeclareClass(const AstRawString* variable_name,
1509 Expression* value, 1509 Expression* value,
1510 ZoneList<const AstRawString*>* names, 1510 ZoneList<const AstRawString*>* names,
1511 int class_token_pos, int end_pos, bool* ok) { 1511 int class_token_pos, int end_pos, bool* ok) {
1512 Declaration* decl = 1512 Declaration* decl =
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after
5027 5027
5028 return final_loop; 5028 return final_loop;
5029 } 5029 }
5030 5030
5031 #undef CHECK_OK 5031 #undef CHECK_OK
5032 #undef CHECK_OK_VOID 5032 #undef CHECK_OK_VOID
5033 #undef CHECK_FAILED 5033 #undef CHECK_FAILED
5034 5034
5035 } // namespace internal 5035 } // namespace internal
5036 } // namespace v8 5036 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698