OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium 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 """IDL type handling. | 4 """IDL type handling. |
5 | 5 |
6 Classes: | 6 Classes: |
7 IdlTypeBase | 7 IdlTypeBase |
8 IdlType | 8 IdlType |
9 IdlUnionType | 9 IdlUnionType |
10 IdlArrayOrSequenceType | 10 IdlArrayOrSequenceType |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 @property | 195 @property |
196 def is_integer_type(self): | 196 def is_integer_type(self): |
197 return self.base_type in INTEGER_TYPES | 197 return self.base_type in INTEGER_TYPES |
198 | 198 |
199 @property | 199 @property |
200 def is_numeric_type(self): | 200 def is_numeric_type(self): |
201 return self.base_type in NUMERIC_TYPES | 201 return self.base_type in NUMERIC_TYPES |
202 | 202 |
203 @property | 203 @property |
204 def is_boolean_type(self): | |
205 return self.base_type == 'boolean' | |
206 | |
207 @property | |
208 def is_primitive_type(self): | 204 def is_primitive_type(self): |
209 return self.base_type in PRIMITIVE_TYPES | 205 return self.base_type in PRIMITIVE_TYPES |
210 | 206 |
211 @property | 207 @property |
212 def is_interface_type(self): | 208 def is_interface_type(self): |
213 # Anything that is not another type is an interface type. | 209 # Anything that is not another type is an interface type. |
214 # http://www.w3.org/TR/WebIDL/#idl-types | 210 # http://www.w3.org/TR/WebIDL/#idl-types |
215 # http://www.w3.org/TR/WebIDL/#idl-interface | 211 # http://www.w3.org/TR/WebIDL/#idl-interface |
216 # In C++ these are RefPtr or PassRefPtr types. | 212 # In C++ these are RefPtr or PassRefPtr types. |
217 return not(self.is_basic_type or | 213 return not(self.is_basic_type or |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 return self.inner_type.name + 'OrNull' | 458 return self.inner_type.name + 'OrNull' |
463 | 459 |
464 def resolve_typedefs(self, typedefs): | 460 def resolve_typedefs(self, typedefs): |
465 self.inner_type = self.inner_type.resolve_typedefs(typedefs) | 461 self.inner_type = self.inner_type.resolve_typedefs(typedefs) |
466 return self | 462 return self |
467 | 463 |
468 def idl_types(self): | 464 def idl_types(self): |
469 yield self | 465 yield self |
470 for idl_type in self.inner_type.idl_types(): | 466 for idl_type in self.inner_type.idl_types(): |
471 yield idl_type | 467 yield idl_type |
OLD | NEW |