| 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/rewriter.h" | 5 #include "src/rewriter.h" |
| 6 | 6 |
| 7 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/parser.h" | 8 #include "src/parser.h" |
| 9 #include "src/scopes.h" | 9 #include "src/scopes.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 AstValueFactory* ast_value_factory) | 29 AstValueFactory* ast_value_factory) |
| 30 : result_(result), | 30 : result_(result), |
| 31 result_assigned_(false), | 31 result_assigned_(false), |
| 32 replacement_(nullptr), | 32 replacement_(nullptr), |
| 33 is_set_(false), | 33 is_set_(false), |
| 34 scope_(scope), | 34 scope_(scope), |
| 35 factory_(ast_value_factory) { | 35 factory_(ast_value_factory) { |
| 36 InitializeAstVisitor(parser->stack_limit()); | 36 InitializeAstVisitor(parser->stack_limit()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual ~Processor() { } | 39 ~Processor() override {} |
| 40 | 40 |
| 41 void Process(ZoneList<Statement*>* statements); | 41 void Process(ZoneList<Statement*>* statements); |
| 42 bool result_assigned() const { return result_assigned_; } | 42 bool result_assigned() const { return result_assigned_; } |
| 43 | 43 |
| 44 Zone* zone() { return zone_; } | 44 Zone* zone() { return zone_; } |
| 45 Scope* scope() { return scope_; } | 45 Scope* scope() { return scope_; } |
| 46 AstNodeFactory* factory() { return &factory_; } | 46 AstNodeFactory* factory() { return &factory_; } |
| 47 | 47 |
| 48 // Returns ".result = value" | 48 // Returns ".result = value" |
| 49 Expression* SetResult(Expression* value) { | 49 Expression* SetResult(Expression* value) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 73 // the stores by keeping track of whether or not we're sure .result | 73 // the stores by keeping track of whether or not we're sure .result |
| 74 // will be overwritten anyway. This is a bit more tricky than what I | 74 // will be overwritten anyway. This is a bit more tricky than what I |
| 75 // was hoping for. | 75 // was hoping for. |
| 76 bool is_set_; | 76 bool is_set_; |
| 77 | 77 |
| 78 Zone* zone_; | 78 Zone* zone_; |
| 79 Scope* scope_; | 79 Scope* scope_; |
| 80 AstNodeFactory factory_; | 80 AstNodeFactory factory_; |
| 81 | 81 |
| 82 // Node visitors. | 82 // Node visitors. |
| 83 #define DEF_VISIT(type) virtual void Visit##type(type* node) override; | 83 #define DEF_VISIT(type) void Visit##type(type* node) override; |
| 84 AST_NODE_LIST(DEF_VISIT) | 84 AST_NODE_LIST(DEF_VISIT) |
| 85 #undef DEF_VISIT | 85 #undef DEF_VISIT |
| 86 | 86 |
| 87 void VisitIterationStatement(IterationStatement* stmt); | 87 void VisitIterationStatement(IterationStatement* stmt); |
| 88 | 88 |
| 89 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 89 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 | 92 |
| 93 Statement* Processor::AssignUndefinedBefore(Statement* s) { | 93 Statement* Processor::AssignUndefinedBefore(Statement* s) { |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 processor.SetResult(undef), expr->position()); | 394 processor.SetResult(undef), expr->position()); |
| 395 body->Add(completion, factory->zone()); | 395 body->Add(completion, factory->zone()); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 return true; | 398 return true; |
| 399 } | 399 } |
| 400 | 400 |
| 401 | 401 |
| 402 } // namespace internal | 402 } // namespace internal |
| 403 } // namespace v8 | 403 } // namespace v8 |
| OLD | NEW |