| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_EXPRESSION_TYPE_COLLECTOR_H_ | 5 #ifndef V8_EXPRESSION_TYPE_COLLECTOR_H_ |
| 6 #define V8_EXPRESSION_TYPE_COLLECTOR_H_ | 6 #define V8_EXPRESSION_TYPE_COLLECTOR_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast-expression-visitor.h" | 8 #include "src/ast/ast-expression-visitor.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 class AstTypeBounds; |
| 14 |
| 13 // A Visitor over an AST that collects a human readable string summarizing | 15 // A Visitor over an AST that collects a human readable string summarizing |
| 14 // structure and types. Used for testing of the typing information attached | 16 // structure and types. Used for testing of the typing information attached |
| 15 // to the expression nodes of an AST. | 17 // to the expression nodes of an AST. |
| 16 | 18 |
| 17 struct ExpressionTypeEntry { | 19 struct ExpressionTypeEntry { |
| 18 int depth; | 20 int depth; |
| 19 const char* kind; | 21 const char* kind; |
| 20 const AstRawString* name; | 22 const AstRawString* name; |
| 21 Bounds bounds; | 23 Bounds bounds; |
| 22 }; | 24 }; |
| 23 | 25 |
| 24 class ExpressionTypeCollector : public AstExpressionVisitor { | 26 class ExpressionTypeCollector : public AstExpressionVisitor { |
| 25 public: | 27 public: |
| 26 ExpressionTypeCollector(Isolate* isolate, FunctionLiteral* root, | 28 ExpressionTypeCollector(Isolate* isolate, FunctionLiteral* root, |
| 29 const AstTypeBounds* bounds, |
| 27 ZoneVector<ExpressionTypeEntry>* dst); | 30 ZoneVector<ExpressionTypeEntry>* dst); |
| 28 void Run(); | 31 void Run(); |
| 29 | 32 |
| 30 protected: | 33 protected: |
| 31 void VisitExpression(Expression* expression); | 34 void VisitExpression(Expression* expression); |
| 32 | 35 |
| 33 private: | 36 private: |
| 37 const AstTypeBounds* bounds_; |
| 34 ZoneVector<ExpressionTypeEntry>* result_; | 38 ZoneVector<ExpressionTypeEntry>* result_; |
| 35 }; | 39 }; |
| 36 } // namespace internal | 40 } // namespace internal |
| 37 } // namespace v8 | 41 } // namespace v8 |
| 38 | 42 |
| 39 #endif // V8_EXPRESSION_TYPE_COLLECTOR_H_ | 43 #endif // V8_EXPRESSION_TYPE_COLLECTOR_H_ |
| OLD | NEW |