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

Side by Side Diff: src/ast.h

Issue 1177053006: [es6] Fix completion values of for loops with lexical variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: offline feedback Created 5 years, 6 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/parser.cc » ('j') | 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 #ifndef V8_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 class Block final : public BreakableStatement { 478 class Block final : public BreakableStatement {
479 public: 479 public:
480 DECLARE_NODE_TYPE(Block) 480 DECLARE_NODE_TYPE(Block)
481 481
482 void AddStatement(Statement* statement, Zone* zone) { 482 void AddStatement(Statement* statement, Zone* zone) {
483 statements_.Add(statement, zone); 483 statements_.Add(statement, zone);
484 } 484 }
485 485
486 ZoneList<Statement*>* statements() { return &statements_; } 486 ZoneList<Statement*>* statements() { return &statements_; }
487 bool is_initializer_block() const { return is_initializer_block_; } 487 bool ignore_completion_value() const { return ignore_completion_value_; }
488 488
489 static int num_ids() { return parent_num_ids() + 1; } 489 static int num_ids() { return parent_num_ids() + 1; }
490 BailoutId DeclsId() const { return BailoutId(local_id(0)); } 490 BailoutId DeclsId() const { return BailoutId(local_id(0)); }
491 491
492 bool IsJump() const override { 492 bool IsJump() const override {
493 return !statements_.is_empty() && statements_.last()->IsJump() 493 return !statements_.is_empty() && statements_.last()->IsJump()
494 && labels() == NULL; // Good enough as an approximation... 494 && labels() == NULL; // Good enough as an approximation...
495 } 495 }
496 496
497 Scope* scope() const { return scope_; } 497 Scope* scope() const { return scope_; }
498 void set_scope(Scope* scope) { scope_ = scope; } 498 void set_scope(Scope* scope) { scope_ = scope; }
499 499
500 protected: 500 protected:
501 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, 501 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
502 bool is_initializer_block, int pos) 502 bool ignore_completion_value, int pos)
503 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), 503 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos),
504 statements_(capacity, zone), 504 statements_(capacity, zone),
505 is_initializer_block_(is_initializer_block), 505 ignore_completion_value_(ignore_completion_value),
506 scope_(NULL) {} 506 scope_(NULL) {}
507 static int parent_num_ids() { return BreakableStatement::num_ids(); } 507 static int parent_num_ids() { return BreakableStatement::num_ids(); }
508 508
509 private: 509 private:
510 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 510 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
511 511
512 ZoneList<Statement*> statements_; 512 ZoneList<Statement*> statements_;
513 bool is_initializer_block_; 513 bool ignore_completion_value_;
514 Scope* scope_; 514 Scope* scope_;
515 }; 515 };
516 516
517 517
518 class Declaration : public AstNode { 518 class Declaration : public AstNode {
519 public: 519 public:
520 VariableProxy* proxy() const { return proxy_; } 520 VariableProxy* proxy() const { return proxy_; }
521 VariableMode mode() const { return mode_; } 521 VariableMode mode() const { return mode_; }
522 Scope* scope() const { return scope_; } 522 Scope* scope() const { return scope_; }
523 virtual InitializationFlag initialization() const = 0; 523 virtual InitializationFlag initialization() const = 0;
(...skipping 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after
3264 return new (zone_) ImportDeclaration(zone_, proxy, import_name, 3264 return new (zone_) ImportDeclaration(zone_, proxy, import_name,
3265 module_specifier, scope, pos); 3265 module_specifier, scope, pos);
3266 } 3266 }
3267 3267
3268 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, 3268 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy,
3269 Scope* scope, 3269 Scope* scope,
3270 int pos) { 3270 int pos) {
3271 return new (zone_) ExportDeclaration(zone_, proxy, scope, pos); 3271 return new (zone_) ExportDeclaration(zone_, proxy, scope, pos);
3272 } 3272 }
3273 3273
3274 Block* NewBlock(ZoneList<const AstRawString*>* labels, 3274 Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity,
3275 int capacity, 3275 bool ignore_completion_value, int pos) {
3276 bool is_initializer_block,
3277 int pos) {
3278 return new (zone_) 3276 return new (zone_)
3279 Block(zone_, labels, capacity, is_initializer_block, pos); 3277 Block(zone_, labels, capacity, ignore_completion_value, pos);
3280 } 3278 }
3281 3279
3282 #define STATEMENT_WITH_LABELS(NodeType) \ 3280 #define STATEMENT_WITH_LABELS(NodeType) \
3283 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ 3281 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \
3284 return new (zone_) NodeType(zone_, labels, pos); \ 3282 return new (zone_) NodeType(zone_, labels, pos); \
3285 } 3283 }
3286 STATEMENT_WITH_LABELS(DoWhileStatement) 3284 STATEMENT_WITH_LABELS(DoWhileStatement)
3287 STATEMENT_WITH_LABELS(WhileStatement) 3285 STATEMENT_WITH_LABELS(WhileStatement)
3288 STATEMENT_WITH_LABELS(ForStatement) 3286 STATEMENT_WITH_LABELS(ForStatement)
3289 STATEMENT_WITH_LABELS(SwitchStatement) 3287 STATEMENT_WITH_LABELS(SwitchStatement)
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
3597 3595
3598 private: 3596 private:
3599 Zone* zone_; 3597 Zone* zone_;
3600 AstValueFactory* ast_value_factory_; 3598 AstValueFactory* ast_value_factory_;
3601 }; 3599 };
3602 3600
3603 3601
3604 } } // namespace v8::internal 3602 } } // namespace v8::internal
3605 3603
3606 #endif // V8_AST_H_ 3604 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698