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

Side by Side Diff: src/ast/ast.h

Issue 2210533002: [modules] Mark namespace variables as kCreatedInitialized. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@modules-VariableLocation
Patch Set: Created 4 years, 4 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 | src/parsing/parser.h » ('j') | src/parsing/parser.cc » ('J')
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 #ifndef V8_AST_AST_H_ 5 #ifndef V8_AST_AST_H_
6 #define V8_AST_AST_H_ 6 #define V8_AST_AST_H_
7 7
8 #include "src/ast/ast-value-factory.h" 8 #include "src/ast/ast-value-factory.h"
9 #include "src/ast/modules.h" 9 #include "src/ast/modules.h"
10 #include "src/ast/variables.h" 10 #include "src/ast/variables.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 // Nested scope from which the declaration originated. 521 // Nested scope from which the declaration originated.
522 Scope* scope_; 522 Scope* scope_;
523 }; 523 };
524 524
525 525
526 class VariableDeclaration final : public Declaration { 526 class VariableDeclaration final : public Declaration {
527 public: 527 public:
528 DECLARE_NODE_TYPE(VariableDeclaration) 528 DECLARE_NODE_TYPE(VariableDeclaration)
529 529
530 InitializationFlag initialization() const { 530 InitializationFlag initialization() const { return initialization_; }
adamk 2016/08/03 17:55:48 Strangely this method is only used inside the pars
531 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization;
532 }
533 531
534 protected: 532 protected:
535 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode, 533 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode,
536 Scope* scope, int pos) 534 Scope* scope, InitializationFlag initialization, int pos)
537 : Declaration(zone, proxy, mode, scope, pos, kVariableDeclaration) {} 535 : Declaration(zone, proxy, mode, scope, pos, kVariableDeclaration),
536 initialization_(initialization) {}
537
538 private:
539 InitializationFlag initialization_;
538 }; 540 };
539 541
540 542
541 class FunctionDeclaration final : public Declaration { 543 class FunctionDeclaration final : public Declaration {
542 public: 544 public:
543 DECLARE_NODE_TYPE(FunctionDeclaration) 545 DECLARE_NODE_TYPE(FunctionDeclaration)
544 546
545 FunctionLiteral* fun() const { return fun_; } 547 FunctionLiteral* fun() const { return fun_; }
546 void set_fun(FunctionLiteral* f) { fun_ = f; } 548 void set_fun(FunctionLiteral* f) { fun_ = f; }
547 InitializationFlag initialization() const { return kCreatedInitialized; } 549 InitializationFlag initialization() const { return kCreatedInitialized; }
(...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 3054
3053 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } 3055 AstValueFactory* ast_value_factory() const { return ast_value_factory_; }
3054 void set_ast_value_factory(AstValueFactory* ast_value_factory) { 3056 void set_ast_value_factory(AstValueFactory* ast_value_factory) {
3055 ast_value_factory_ = ast_value_factory; 3057 ast_value_factory_ = ast_value_factory;
3056 zone_ = ast_value_factory->zone(); 3058 zone_ = ast_value_factory->zone();
3057 } 3059 }
3058 3060
3059 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, 3061 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
3060 VariableMode mode, Scope* scope, 3062 VariableMode mode, Scope* scope,
3061 int pos) { 3063 int pos) {
3062 return new (zone_) VariableDeclaration(zone_, proxy, mode, scope, pos); 3064 return NewVariableDeclaration(
3065 proxy, mode, scope,
3066 mode == VAR ? kCreatedInitialized : kNeedsInitialization, pos);
3067 }
3068
3069 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
3070 VariableMode mode, Scope* scope,
3071 InitializationFlag init,
3072 int pos) {
3073 return new (zone_)
3074 VariableDeclaration(zone_, proxy, mode, scope, init, pos);
3063 } 3075 }
3064 3076
3065 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, 3077 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy,
3066 VariableMode mode, 3078 VariableMode mode,
3067 FunctionLiteral* fun, 3079 FunctionLiteral* fun,
3068 Scope* scope, 3080 Scope* scope,
3069 int pos) { 3081 int pos) {
3070 return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos); 3082 return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos);
3071 } 3083 }
3072 3084
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
3519 : NULL; \ 3531 : NULL; \
3520 } 3532 }
3521 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3533 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3522 #undef DECLARE_NODE_FUNCTIONS 3534 #undef DECLARE_NODE_FUNCTIONS
3523 3535
3524 3536
3525 } // namespace internal 3537 } // namespace internal
3526 } // namespace v8 3538 } // namespace v8
3527 3539
3528 #endif // V8_AST_AST_H_ 3540 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.h » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698