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 #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/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 V(PredefinedType) \ | 104 V(PredefinedType) \ |
105 V(ThisType) \ | 105 V(ThisType) \ |
106 V(UnionType) \ | 106 V(UnionType) \ |
107 V(IntersectionType) \ | 107 V(IntersectionType) \ |
108 V(ArrayType) \ | 108 V(ArrayType) \ |
109 V(FunctionType) \ | 109 V(FunctionType) \ |
110 V(TypeParameter) \ | 110 V(TypeParameter) \ |
111 V(FormalParameter) \ | 111 V(FormalParameter) \ |
112 V(TypeReference) \ | 112 V(TypeReference) \ |
113 V(StringLiteralType) \ | 113 V(StringLiteralType) \ |
| 114 V(QueryType) \ |
114 V(TypeOrParameters) | 115 V(TypeOrParameters) |
115 | 116 |
116 // Forward declarations | 117 // Forward declarations |
117 class AstNodeFactory; | 118 class AstNodeFactory; |
118 class AstVisitor; | 119 class AstVisitor; |
119 class Declaration; | 120 class Declaration; |
120 class Module; | 121 class Module; |
121 class BreakableStatement; | 122 class BreakableStatement; |
122 class Expression; | 123 class Expression; |
123 class IterationStatement; | 124 class IterationStatement; |
(...skipping 3022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 | 3147 |
3147 protected: | 3148 protected: |
3148 StringLiteralType(Zone* zone, const AstRawString* string, int pos) | 3149 StringLiteralType(Zone* zone, const AstRawString* string, int pos) |
3149 : Type(zone, pos), string_(string) {} | 3150 : Type(zone, pos), string_(string) {} |
3150 | 3151 |
3151 private: | 3152 private: |
3152 const AstRawString* string_; | 3153 const AstRawString* string_; |
3153 }; | 3154 }; |
3154 | 3155 |
3155 | 3156 |
| 3157 class QueryType : public Type { |
| 3158 public: |
| 3159 DECLARE_NODE_TYPE(QueryType) |
| 3160 |
| 3161 const AstRawString* name() const { return name_; } |
| 3162 ZoneList<const AstRawString*>* property_names() const { |
| 3163 return property_names_; |
| 3164 } |
| 3165 |
| 3166 protected: |
| 3167 QueryType(Zone* zone, const AstRawString* name, |
| 3168 ZoneList<const AstRawString*>* property_names, int pos) |
| 3169 : Type(zone, pos), name_(name), property_names_(property_names) {} |
| 3170 |
| 3171 private: |
| 3172 const AstRawString* name_; |
| 3173 ZoneList<const AstRawString*>* property_names_; |
| 3174 }; |
| 3175 |
| 3176 |
3156 class TypeOrParameters : public Type { | 3177 class TypeOrParameters : public Type { |
3157 public: | 3178 public: |
3158 DECLARE_NODE_TYPE(TypeOrParameters) | 3179 DECLARE_NODE_TYPE(TypeOrParameters) |
3159 | 3180 |
3160 ZoneList<FormalParameter*>* parameters() const { return parameters_; } | 3181 ZoneList<FormalParameter*>* parameters() const { return parameters_; } |
3161 | 3182 |
3162 protected: | 3183 protected: |
3163 TypeOrParameters(Zone* zone, ZoneList<FormalParameter*>* parameters, int pos) | 3184 TypeOrParameters(Zone* zone, ZoneList<FormalParameter*>* parameters, int pos) |
3164 : Type(zone, pos), parameters_(parameters) {} | 3185 : Type(zone, pos), parameters_(parameters) {} |
3165 | 3186 |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3791 return new (local_zone_) | 3812 return new (local_zone_) |
3792 typesystem::TypeReference(local_zone_, name, type_arguments, pos); | 3813 typesystem::TypeReference(local_zone_, name, type_arguments, pos); |
3793 } | 3814 } |
3794 | 3815 |
3795 typesystem::StringLiteralType* NewStringLiteralType( | 3816 typesystem::StringLiteralType* NewStringLiteralType( |
3796 const AstRawString* string, int pos) { | 3817 const AstRawString* string, int pos) { |
3797 return new (local_zone_) | 3818 return new (local_zone_) |
3798 typesystem::StringLiteralType(local_zone_, string, pos); | 3819 typesystem::StringLiteralType(local_zone_, string, pos); |
3799 } | 3820 } |
3800 | 3821 |
| 3822 typesystem::QueryType* NewQueryType( |
| 3823 const AstRawString* name, ZoneList<const AstRawString*>* property_names, |
| 3824 int pos) { |
| 3825 return new (local_zone_) |
| 3826 typesystem::QueryType(local_zone_, name, property_names, pos); |
| 3827 } |
| 3828 |
3801 typesystem::FormalParameter* NewFormalParameter(const AstRawString* name, | 3829 typesystem::FormalParameter* NewFormalParameter(const AstRawString* name, |
3802 bool optional, bool spread, | 3830 bool optional, bool spread, |
3803 typesystem::Type* type, | 3831 typesystem::Type* type, |
3804 int pos) { | 3832 int pos) { |
3805 return new (local_zone_) typesystem::FormalParameter( | 3833 return new (local_zone_) typesystem::FormalParameter( |
3806 local_zone_, name, optional, spread, type, pos); | 3834 local_zone_, name, optional, spread, type, pos); |
3807 } | 3835 } |
3808 | 3836 |
3809 typesystem::FormalParameter* NewFormalParameter(typesystem::Type* type, | 3837 typesystem::FormalParameter* NewFormalParameter(typesystem::Type* type, |
3810 int pos) { | 3838 int pos) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3910 : NULL; \ | 3938 : NULL; \ |
3911 } | 3939 } |
3912 TYPESYSTEM_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3940 TYPESYSTEM_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3913 #undef DECLARE_NODE_FUNCTIONS | 3941 #undef DECLARE_NODE_FUNCTIONS |
3914 | 3942 |
3915 | 3943 |
3916 } // namespace internal | 3944 } // namespace internal |
3917 } // namespace v8 | 3945 } // namespace v8 |
3918 | 3946 |
3919 #endif // V8_AST_AST_H_ | 3947 #endif // V8_AST_AST_H_ |
OLD | NEW |