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

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

Issue 11887006: Changed @domName annotation in comment to full fledge @DomName annotation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, 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 """This module provides shared functionality for systems to generate 6 """This module provides shared functionality for systems to generate
7 Dart APIs from the IDL database.""" 7 Dart APIs from the IDL database."""
8 8
9 import copy 9 import copy
10 import re 10 import re
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 "@Experimental()", 711 "@Experimental()",
712 ], 712 ],
713 'WebSocket': _all_but_ie9_annotations, 713 'WebSocket': _all_but_ie9_annotations,
714 'WorkerContext.indexedDB': _indexed_db_annotations, 714 'WorkerContext.indexedDB': _indexed_db_annotations,
715 } 715 }
716 716
717 def FindCommonAnnotations(interface_name, member_name=None): 717 def FindCommonAnnotations(interface_name, member_name=None):
718 """ Finds annotations common between dart2js and dartium. 718 """ Finds annotations common between dart2js and dartium.
719 """ 719 """
720 if member_name: 720 if member_name:
721 return dart_annotations.get('%s.%s' % (interface_name, member_name)) 721 key = '%s.%s' % (interface_name, member_name)
722 else: 722 else:
723 return dart_annotations.get(interface_name) 723 key = interface_name
724
725 annotations = ["@DomName('" + key + "')"]
726 if (dart_annotations.get(key) != None):
727 annotations.extend(dart_annotations.get(key))
728
729 return annotations
724 730
725 def FindDart2JSAnnotations(idl_type, interface_name, member_name): 731 def FindDart2JSAnnotations(idl_type, interface_name, member_name):
726 """ Finds all annotations for Dart2JS members- including annotations for 732 """ Finds all annotations for Dart2JS members- including annotations for
727 both dart2js and dartium. 733 both dart2js and dartium.
728 """ 734 """
729 annotations = FindCommonAnnotations(interface_name, member_name) 735 annotations = FindCommonAnnotations(interface_name, member_name)
730 if annotations: 736 if annotations:
731 annotations = ' '.join(annotations) 737 annotations = ' '.join(annotations)
732 738
733 ann2 = _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name) 739 ann2 = _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name)
734 if ann2: 740 if ann2:
735 if annotations: 741 if annotations:
736 annotations = annotations + ' ' + ann2 742 annotations = annotations + ' ' + ann2
737 else: 743 else:
738 annotations = ann2 744 annotations = ann2
739 return annotations 745 return annotations
740 746
747 def AnyConversionAnnotations(idl_type, interface_name, member_name):
748 if (dart_annotations.get('%s.%s' % (interface_name, member_name)) or
749 _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name)):
750 return True
751 else:
752 return False
753
741 def _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name): 754 def _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name):
742 """ Finds dart2js-specific annotations. This does not include ones shared with 755 """ Finds dart2js-specific annotations. This does not include ones shared with
743 dartium. 756 dartium.
744 """ 757 """
745 ann1 = dart2js_annotations.get("%s.%s" % (interface_name, member_name)) 758 ann1 = dart2js_annotations.get("%s.%s" % (interface_name, member_name))
746 if ann1: 759 if ann1:
747 ann2 = dart2js_annotations.get('+' + idl_type) 760 ann2 = dart2js_annotations.get('+' + idl_type)
748 if ann2: 761 if ann2:
749 return ann2 + ' ' + ann1 762 return ann2 + ' ' + ann1
750 ann2 = dart2js_annotations.get(idl_type) 763 ann2 = dart2js_annotations.get(idl_type)
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 self) 1297 self)
1285 1298
1286 if type_data.clazz == 'SVGTearOff': 1299 if type_data.clazz == 'SVGTearOff':
1287 dart_interface_name = self._renamer.RenameInterface( 1300 dart_interface_name = self._renamer.RenameInterface(
1288 self._database.GetInterface(type_name)) 1301 self._database.GetInterface(type_name))
1289 return SVGTearOffIDLTypeInfo( 1302 return SVGTearOffIDLTypeInfo(
1290 type_name, type_data, dart_interface_name, self) 1303 type_name, type_data, dart_interface_name, self)
1291 1304
1292 class_name = '%sIDLTypeInfo' % type_data.clazz 1305 class_name = '%sIDLTypeInfo' % type_data.clazz
1293 return globals()[class_name](type_name, type_data) 1306 return globals()[class_name](type_name, type_data)
OLDNEW
« no previous file with comments | « sdk/lib/web_audio/dartium/web_audio_dartium.dart ('k') | tools/dom/scripts/htmldartgenerator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698