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 IdlType | 7 IdlType |
8 IdlUnionType | 8 IdlUnionType |
9 """ | 9 """ |
10 | 10 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 @property | 167 @property |
168 def is_integer_type(self): | 168 def is_integer_type(self): |
169 return self.base_type in INTEGER_TYPES and not self.array_or_sequence_ty
pe | 169 return self.base_type in INTEGER_TYPES and not self.array_or_sequence_ty
pe |
170 | 170 |
171 @property | 171 @property |
172 def is_numeric_type(self): | 172 def is_numeric_type(self): |
173 return self.base_type in NUMERIC_TYPES and not self.array_or_sequence_ty
pe | 173 return self.base_type in NUMERIC_TYPES and not self.array_or_sequence_ty
pe |
174 | 174 |
175 @property | 175 @property |
| 176 def is_primitive_type(self): |
| 177 return self.base_type in PRIMITIVE_TYPES and not self.array_or_sequence_
type |
| 178 |
| 179 @property |
176 def is_interface_type(self): | 180 def is_interface_type(self): |
177 # Anything that is not another type is an interface type. | 181 # Anything that is not another type is an interface type. |
178 # http://www.w3.org/TR/WebIDL/#idl-types | 182 # http://www.w3.org/TR/WebIDL/#idl-types |
179 # http://www.w3.org/TR/WebIDL/#idl-interface | 183 # http://www.w3.org/TR/WebIDL/#idl-interface |
180 # In C++ these are RefPtr or PassRefPtr types. | 184 # In C++ these are RefPtr or PassRefPtr types. |
181 return not(self.is_basic_type or | 185 return not(self.is_basic_type or |
182 self.is_composite_type or | 186 self.is_composite_type or |
183 self.is_callback_function or | 187 self.is_callback_function or |
184 self.is_enum or | 188 self.is_enum or |
185 self.name == 'Object' or | 189 self.name == 'Object' or |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 286 |
283 @property | 287 @property |
284 def is_integer_type(self): | 288 def is_integer_type(self): |
285 return False | 289 return False |
286 | 290 |
287 @property | 291 @property |
288 def is_numeric_type(self): | 292 def is_numeric_type(self): |
289 return False | 293 return False |
290 | 294 |
291 @property | 295 @property |
| 296 def is_primitivee_type(self): |
| 297 return False |
| 298 |
| 299 @property |
292 def is_sequence(self): | 300 def is_sequence(self): |
293 # We do not support sequences of union types | 301 # We do not support sequences of union types |
294 return False | 302 return False |
295 | 303 |
296 @property | 304 @property |
297 def is_union_type(self): | 305 def is_union_type(self): |
298 return True | 306 return True |
299 | 307 |
300 @property | 308 @property |
301 def name(self): | 309 def name(self): |
302 return 'Or'.join(member_type.name for member_type in self.member_types) | 310 return 'Or'.join(member_type.name for member_type in self.member_types) |
303 | 311 |
304 def resolve_typedefs(self, typedefs): | 312 def resolve_typedefs(self, typedefs): |
305 self.member_types = [ | 313 self.member_types = [ |
306 typedefs.get(member_type, member_type) | 314 typedefs.get(member_type, member_type) |
307 for member_type in self.member_types] | 315 for member_type in self.member_types] |
308 return self | 316 return self |
OLD | NEW |