OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 self.stringifier = None | 277 self.stringifier = None |
278 if not node: # Early exit for IdlException.__init__ | 278 if not node: # Early exit for IdlException.__init__ |
279 return | 279 return |
280 | 280 |
281 self.is_callback = node.GetProperty('CALLBACK') or False | 281 self.is_callback = node.GetProperty('CALLBACK') or False |
282 self.is_exception = False | 282 self.is_exception = False |
283 # FIXME: uppercase 'Partial' => 'PARTIAL' in base IDL parser | 283 # FIXME: uppercase 'Partial' => 'PARTIAL' in base IDL parser |
284 self.is_partial = node.GetProperty('Partial') or False | 284 self.is_partial = node.GetProperty('Partial') or False |
285 self.idl_name = idl_name | 285 self.idl_name = idl_name |
286 self.name = node.GetName() | 286 self.name = node.GetName() |
| 287 self.idl_type = IdlType(self.name) |
287 | 288 |
288 children = node.GetChildren() | 289 children = node.GetChildren() |
289 for child in children: | 290 for child in children: |
290 child_class = child.GetClass() | 291 child_class = child.GetClass() |
291 if child_class == 'Attribute': | 292 if child_class == 'Attribute': |
292 self.attributes.append(IdlAttribute(idl_name, child)) | 293 self.attributes.append(IdlAttribute(idl_name, child)) |
293 elif child_class == 'Const': | 294 elif child_class == 'Const': |
294 self.constants.append(IdlConstant(idl_name, child)) | 295 self.constants.append(IdlConstant(idl_name, child)) |
295 elif child_class == 'ExtAttributes': | 296 elif child_class == 'ExtAttributes': |
296 extended_attributes = ext_attributes_node_to_extended_attributes
(idl_name, child) | 297 extended_attributes = ext_attributes_node_to_extended_attributes
(idl_name, child) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 # restricted subclass of interfaces. | 344 # restricted subclass of interfaces. |
344 # http://www.w3.org/TR/WebIDL/#idl-exceptions | 345 # http://www.w3.org/TR/WebIDL/#idl-exceptions |
345 def __init__(self, idl_name, node): | 346 def __init__(self, idl_name, node): |
346 # Exceptions are similar to Interfaces, but simpler | 347 # Exceptions are similar to Interfaces, but simpler |
347 IdlInterface.__init__(self, idl_name) | 348 IdlInterface.__init__(self, idl_name) |
348 self.is_callback = False | 349 self.is_callback = False |
349 self.is_exception = True | 350 self.is_exception = True |
350 self.is_partial = False | 351 self.is_partial = False |
351 self.idl_name = idl_name | 352 self.idl_name = idl_name |
352 self.name = node.GetName() | 353 self.name = node.GetName() |
| 354 self.idl_type = IdlType(self.name) |
353 | 355 |
354 children = node.GetChildren() | 356 children = node.GetChildren() |
355 for child in children: | 357 for child in children: |
356 child_class = child.GetClass() | 358 child_class = child.GetClass() |
357 if child_class == 'Attribute': | 359 if child_class == 'Attribute': |
358 attribute = IdlAttribute(idl_name, child) | 360 attribute = IdlAttribute(idl_name, child) |
359 self.attributes.append(attribute) | 361 self.attributes.append(attribute) |
360 elif child_class == 'Const': | 362 elif child_class == 'Const': |
361 self.constants.append(IdlConstant(idl_name, child)) | 363 self.constants.append(IdlConstant(idl_name, child)) |
362 elif child_class == 'ExtAttributes': | 364 elif child_class == 'ExtAttributes': |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 child_class = child.GetClass() | 819 child_class = child.GetClass() |
818 if child_class != 'Type': | 820 if child_class != 'Type': |
819 raise ValueError('Unrecognized node class: %s' % child_class) | 821 raise ValueError('Unrecognized node class: %s' % child_class) |
820 return type_node_to_type(child) | 822 return type_node_to_type(child) |
821 | 823 |
822 | 824 |
823 def union_type_node_to_idl_union_type(node): | 825 def union_type_node_to_idl_union_type(node): |
824 member_types = [type_node_to_type(member_type_node) | 826 member_types = [type_node_to_type(member_type_node) |
825 for member_type_node in node.GetChildren()] | 827 for member_type_node in node.GetChildren()] |
826 return IdlUnionType(member_types) | 828 return IdlUnionType(member_types) |
OLD | NEW |