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