Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: tools/dom/scripts/idlnode.py

Issue 1720743005: Generation of sdk/lib files from 45 roll (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with TOT Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, IdlNullableType, IdlUnionType, IdlArrayOrSequence Type 10 from idl_types import IdlType, IdlNullableType, IdlUnionType, IdlArrayOrSequence Type
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 if label == 'ScopedName': 566 if label == 'ScopedName':
567 self.id = value 567 self.id = value
568 else: 568 else:
569 self.id = self._label_to_type(label, ast) 569 self.id = self._label_to_type(label, ast)
570 elif isinstance(ast, str): 570 elif isinstance(ast, str):
571 self.id = ast 571 self.id = ast
572 # New blink handling. 572 # New blink handling.
573 elif ast.__module__ == "idl_types": 573 elif ast.__module__ == "idl_types":
574 if isinstance(ast, IdlType) or isinstance(ast, IdlArrayOrSequenceType) or \ 574 if isinstance(ast, IdlType) or isinstance(ast, IdlArrayOrSequenceType) or \
575 isinstance(ast, IdlNullableType): 575 isinstance(ast, IdlNullableType):
576 type_name = str(ast) 576 if isinstance(ast, IdlNullableType) and ast.inner_type.is_union_type:
577 # TODO(terry): For now don't handle unrestricted types see 577 print 'WARNING type %s is union mapped to \'any\'' % self.id
578 # https://code.google.com/p/chromium/issues/detail?id=35429 8 578 # TODO(terry): For union types use any otherwise type is unionType is
579 type_name = type_name.replace('unrestricted ', '', 1); 579 # not found and is removed during merging.
580 self.id = 'any'
581 else:
582 type_name = str(ast)
583 # TODO(terry): For now don't handle unrestricted types see
584 # https://code.google.com/p/chromium/issues/detail?id=354 298
585 type_name = type_name.replace('unrestricted ', '', 1);
580 586
581 # TODO(terry): Handled USVString as a DOMString. 587 # TODO(terry): Handled USVString as a DOMString.
582 type_name = type_name.replace('USVString', 'DOMString', 1) 588 type_name = type_name.replace('USVString', 'DOMString', 1)
583 589
584 self.id = type_name 590 # TODO(terry); WindowTimers setInterval/setTimeout overloads with a
591 # Function type - map to any until the IDL uses union.
592 type_name = type_name.replace('Function', 'any', 1)
593
594 self.id = type_name
585 else: 595 else:
586 # IdlUnionType 596 # IdlUnionType
587 if ast.is_union_type: 597 if ast.is_union_type:
588 print 'WARNING type %s is union mapped to \'any\'' % self.id 598 print 'WARNING type %s is union mapped to \'any\'' % self.id
589 # TODO(terry): For union types use any otherwise type is unionType is 599 # TODO(terry): For union types use any otherwise type is unionType is
590 # not found and is removed during merging. 600 # not found and is removed during merging.
591 self.id = 'any' 601 self.id = 'any'
592 # TODO(terry): Any union type e.g. 'type1 or type2 or type2', 602 # TODO(terry): Any union type e.g. 'type1 or type2 or type2',
593 # 'typedef (Type1 or Type2) UnionType' 603 # 'typedef (Type1 or Type2) UnionType'
594 # Is a problem we need to extend IDLType and IDLTypeDef to handle more 604 # Is a problem we need to extend IDLType and IDLTypeDef to handle more
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 """IDLDictNode specialization for one annotation.""" 883 """IDLDictNode specialization for one annotation."""
874 def __init__(self, ast=None): 884 def __init__(self, ast=None):
875 IDLDictNode.__init__(self, ast) 885 IDLDictNode.__init__(self, ast)
876 self.id = None 886 self.id = None
877 if not ast: 887 if not ast:
878 return 888 return
879 for arg in self._find_all(ast, 'AnnotationArg'): 889 for arg in self._find_all(ast, 'AnnotationArg'):
880 name = self._find_first(arg, 'Id') 890 name = self._find_first(arg, 'Id')
881 value = self._find_first(arg, 'AnnotationArgValue') 891 value = self._find_first(arg, 'AnnotationArgValue')
882 self[name] = value 892 self[name] = value
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698