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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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): | 200 def may_raise_exception_on_conversion(self): |
201 return (self.is_integer_type or | 201 return (self.is_integer_type or |
| 202 self.is_dictionary or |
202 self.name in ('ByteString', 'ScalarValueString')) | 203 self.name in ('ByteString', 'ScalarValueString')) |
203 | 204 |
204 @property | 205 @property |
205 def is_union_type(self): | 206 def is_union_type(self): |
206 return isinstance(self, IdlUnionType) | 207 return isinstance(self, IdlUnionType) |
207 | 208 |
208 @property | 209 @property |
209 def name(self): | 210 def name(self): |
210 """Return type name | 211 """Return type name |
211 | 212 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 def is_nullable(self): | 330 def is_nullable(self): |
330 return True | 331 return True |
331 | 332 |
332 @property | 333 @property |
333 def name(self): | 334 def name(self): |
334 return self.inner_type.name + 'OrNull' | 335 return self.inner_type.name + 'OrNull' |
335 | 336 |
336 def resolve_typedefs(self, typedefs): | 337 def resolve_typedefs(self, typedefs): |
337 self.inner_type = self.inner_type.resolve_typedefs(typedefs) | 338 self.inner_type = self.inner_type.resolve_typedefs(typedefs) |
338 return self | 339 return self |
OLD | NEW |