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 |
204 def is_primitive_type(self): | 208 def is_primitive_type(self): |
205 return self.base_type in PRIMITIVE_TYPES | 209 return self.base_type in PRIMITIVE_TYPES |
206 | 210 |
207 @property | 211 @property |
208 def is_interface_type(self): | 212 def is_interface_type(self): |
209 # Anything that is not another type is an interface type. | 213 # Anything that is not another type is an interface type. |
210 # http://www.w3.org/TR/WebIDL/#idl-types | 214 # http://www.w3.org/TR/WebIDL/#idl-types |
211 # http://www.w3.org/TR/WebIDL/#idl-interface | 215 # http://www.w3.org/TR/WebIDL/#idl-interface |
212 # In C++ these are RefPtr or PassRefPtr types. | 216 # In C++ these are RefPtr or PassRefPtr types. |
213 return not(self.is_basic_type or | 217 return not(self.is_basic_type or |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 return self.inner_type.name + 'OrNull' | 462 return self.inner_type.name + 'OrNull' |
459 | 463 |
460 def resolve_typedefs(self, typedefs): | 464 def resolve_typedefs(self, typedefs): |
461 self.inner_type = self.inner_type.resolve_typedefs(typedefs) | 465 self.inner_type = self.inner_type.resolve_typedefs(typedefs) |
462 return self | 466 return self |
463 | 467 |
464 def idl_types(self): | 468 def idl_types(self): |
465 yield self | 469 yield self |
466 for idl_type in self.inner_type.idl_types(): | 470 for idl_type in self.inner_type.idl_types(): |
467 yield idl_type | 471 yield idl_type |
OLD | NEW |