OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import sys | 7 import sys |
8 | 8 |
9 import idl_definitions | 9 import idl_definitions |
10 from idl_types import IdlType, IdlUnionType, IdlArrayOrSequenceType | 10 from idl_types import IdlType, IdlUnionType |
11 | 11 |
12 from compute_interfaces_info_overall import interfaces_info | 12 from compute_interfaces_info_overall import interfaces_info |
13 | 13 |
14 | 14 |
15 new_asts = {} | 15 new_asts = {} |
16 | 16 |
17 | 17 |
18 _operation_suffix_map = { | 18 _operation_suffix_map = { |
19 '__getter__': "Getter", | 19 '__getter__': "Getter", |
20 '__setter__': "Setter", | 20 '__setter__': "Setter", |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 elif isinstance(ast, tuple): | 540 elif isinstance(ast, tuple): |
541 (label, value) = ast | 541 (label, value) = ast |
542 if label == 'ScopedName': | 542 if label == 'ScopedName': |
543 self.id = value | 543 self.id = value |
544 else: | 544 else: |
545 self.id = self._label_to_type(label, ast) | 545 self.id = self._label_to_type(label, ast) |
546 elif isinstance(ast, str): | 546 elif isinstance(ast, str): |
547 self.id = ast | 547 self.id = ast |
548 # New blink handling. | 548 # New blink handling. |
549 elif ast.__module__ == "idl_types": | 549 elif ast.__module__ == "idl_types": |
550 if isinstance(ast, IdlType) or isinstance(ast, IdlArrayOrSequenceType): | 550 if isinstance(ast, IdlType): |
551 type_name = str(ast) | 551 type_name = str(ast) |
552 | 552 |
553 # TODO(terry): For now don't handle unrestricted types see | 553 # TODO(terry): For now don't handle unrestricted types see |
554 # https://code.google.com/p/chromium/issues/detail?id=35429
8 | 554 # https://code.google.com/p/chromium/issues/detail?id=35429
8 |
555 type_name = type_name.replace('unrestricted ', '', 1); | 555 type_name = type_name.replace('unrestricted ', '', 1); |
556 | 556 |
557 # TODO(terry): Handled ScalarValueString as a DOMString. | 557 # TODO(terry): Handled ScalarValueString as a DOMString. |
558 type_name = type_name.replace('ScalarValueString', 'DOMString', 1) | 558 type_name = type_name.replace('ScalarValueString', 'DOMString', 1) |
559 | 559 |
560 self.id = type_name | 560 self.id = type_name |
561 else: | 561 else: |
562 # IdlUnionType | 562 # IdlUnionType |
563 if ast.is_union_type: | 563 assert ast.is_union_type |
564 print 'WARNING type %s is union mapped to \'any\'' % self.id | |
565 # TODO(terry): For union types use any otherwise type is unionType is | 564 # TODO(terry): For union types use any otherwise type is unionType is |
566 # not found and is removed during merging. | 565 # not found and is removed during merging. |
567 self.id = 'any' | 566 self.id = 'any' |
568 # TODO(terry): Any union type e.g. 'type1 or type2 or type2', | 567 # TODO(terry): Any union type e.g. 'type1 or type2 or type2', |
569 # 'typedef (Type1 or Type2) UnionType' | 568 # 'typedef (Type1 or Type2) UnionType' |
570 # Is a problem we need to extend IDLType and IDLTypeDef to handle more | 569 # Is a problem we need to extend IDLType and IDLTypeDef to handle more |
571 # than one type. | 570 # than one type. |
572 # | 571 # |
573 # Also for typedef's e.g., | 572 # Also for typedef's e.g., |
574 # typedef (Type1 or Type2) UnionType | 573 # typedef (Type1 or Type2) UnionType |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 """IDLDictNode specialization for one annotation.""" | 810 """IDLDictNode specialization for one annotation.""" |
812 def __init__(self, ast=None): | 811 def __init__(self, ast=None): |
813 IDLDictNode.__init__(self, ast) | 812 IDLDictNode.__init__(self, ast) |
814 self.id = None | 813 self.id = None |
815 if not ast: | 814 if not ast: |
816 return | 815 return |
817 for arg in self._find_all(ast, 'AnnotationArg'): | 816 for arg in self._find_all(ast, 'AnnotationArg'): |
818 name = self._find_first(arg, 'Id') | 817 name = self._find_first(arg, 'Id') |
819 value = self._find_first(arg, 'AnnotationArgValue') | 818 value = self._find_first(arg, 'AnnotationArgValue') |
820 self[name] = value | 819 self[name] = value |
OLD | NEW |