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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 self.is_enum or | 190 self.is_enum or |
191 self.name == 'Any' or | 191 self.name == 'Any' or |
192 self.name == 'Object' or | 192 self.name == 'Object' or |
193 self.name == 'Promise') # Promise will be basic in future | 193 self.name == 'Promise') # Promise will be basic in future |
194 | 194 |
195 @property | 195 @property |
196 def is_string_type(self): | 196 def is_string_type(self): |
197 return self.name in STRING_TYPES | 197 return self.name in STRING_TYPES |
198 | 198 |
199 @property | 199 @property |
200 def may_raise_exception_on_conversion(self): | |
201 return (self.is_integer_type or | |
202 self.name in ('ByteString', 'ScalarValueString')) | |
203 | |
204 @property | |
205 def is_union_type(self): | 200 def is_union_type(self): |
206 return isinstance(self, IdlUnionType) | 201 return isinstance(self, IdlUnionType) |
207 | 202 |
208 @property | 203 @property |
209 def name(self): | 204 def name(self): |
210 """Return type name | 205 """Return type name |
211 | 206 |
212 http://heycam.github.io/webidl/#dfn-type-name | 207 http://heycam.github.io/webidl/#dfn-type-name |
213 """ | 208 """ |
214 base_type = self.base_type | 209 base_type = self.base_type |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 def is_nullable(self): | 324 def is_nullable(self): |
330 return True | 325 return True |
331 | 326 |
332 @property | 327 @property |
333 def name(self): | 328 def name(self): |
334 return self.inner_type.name + 'OrNull' | 329 return self.inner_type.name + 'OrNull' |
335 | 330 |
336 def resolve_typedefs(self, typedefs): | 331 def resolve_typedefs(self, typedefs): |
337 self.inner_type = self.inner_type.resolve_typedefs(typedefs) | 332 self.inner_type = self.inner_type.resolve_typedefs(typedefs) |
338 return self | 333 return self |
OLD | NEW |