| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 # Anything that is not another type is an interface type. | 208 # Anything that is not another type is an interface type. |
| 209 # http://www.w3.org/TR/WebIDL/#idl-types | 209 # http://www.w3.org/TR/WebIDL/#idl-types |
| 210 # http://www.w3.org/TR/WebIDL/#idl-interface | 210 # http://www.w3.org/TR/WebIDL/#idl-interface |
| 211 # In C++ these are RefPtr or PassRefPtr types. | 211 # In C++ these are RefPtr or PassRefPtr types. |
| 212 return not(self.is_basic_type or | 212 return not(self.is_basic_type or |
| 213 self.is_callback_function or | 213 self.is_callback_function or |
| 214 self.is_dictionary or | 214 self.is_dictionary or |
| 215 self.is_enum or | 215 self.is_enum or |
| 216 self.name == 'Any' or | 216 self.name == 'Any' or |
| 217 self.name == 'Object' or | 217 self.name == 'Object' or |
| 218 self.name == 'Promise') # Promise will be basic in future | 218 self.name == 'Promise' or |
| 219 self.name == 'ReadableStream2') # Promise will be basic in f
uture |
| 219 | 220 |
| 220 @property | 221 @property |
| 221 def is_string_type(self): | 222 def is_string_type(self): |
| 222 return self.name in STRING_TYPES | 223 return self.name in STRING_TYPES |
| 223 | 224 |
| 224 @property | 225 @property |
| 225 def name(self): | 226 def name(self): |
| 226 """Return type name | 227 """Return type name |
| 227 | 228 |
| 228 http://heycam.github.io/webidl/#dfn-type-name | 229 http://heycam.github.io/webidl/#dfn-type-name |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return self.inner_type.name + 'OrNull' | 436 return self.inner_type.name + 'OrNull' |
| 436 | 437 |
| 437 def resolve_typedefs(self, typedefs): | 438 def resolve_typedefs(self, typedefs): |
| 438 self.inner_type = self.inner_type.resolve_typedefs(typedefs) | 439 self.inner_type = self.inner_type.resolve_typedefs(typedefs) |
| 439 return self | 440 return self |
| 440 | 441 |
| 441 def idl_types(self): | 442 def idl_types(self): |
| 442 yield self | 443 yield self |
| 443 for idl_type in self.inner_type.idl_types(): | 444 for idl_type in self.inner_type.idl_types(): |
| 444 yield idl_type | 445 yield idl_type |
| OLD | NEW |