| OLD | NEW |
| 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 the system to generate | 6 """This module provides shared functionality for the system to generate |
| 7 Dart:html APIs from the IDL database.""" | 7 Dart:html APIs from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import monitored | 10 import monitored |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 implements_str = ' implements ' + ', '.join(set(implements)) | 523 implements_str = ' implements ' + ', '.join(set(implements)) |
| 524 | 524 |
| 525 mixins = self._backend.Mixins() | 525 mixins = self._backend.Mixins() |
| 526 mixins_str = '' | 526 mixins_str = '' |
| 527 if mixins: | 527 if mixins: |
| 528 mixins_str = ' with ' + ', '.join(mixins) | 528 mixins_str = ' with ' + ', '.join(mixins) |
| 529 if not base_class: | 529 if not base_class: |
| 530 base_class = 'Object' | 530 base_class = 'Object' |
| 531 | 531 |
| 532 annotations = self._metadata.GetFormattedMetadata( | 532 annotations = self._metadata.GetFormattedMetadata( |
| 533 self._library_name, self._interface.doc_js_name, '') | 533 self._library_name, self._interface, None, '') |
| 534 | 534 |
| 535 class_modifiers = '' | 535 class_modifiers = '' |
| 536 if self._renamer.ShouldSuppressInterface(self._interface): | 536 if self._renamer.ShouldSuppressInterface(self._interface): |
| 537 class_modifiers = 'abstract ' | 537 class_modifiers = 'abstract ' |
| 538 | 538 |
| 539 self._implementation_members_emitter = implementation_emitter.Emit( | 539 self._implementation_members_emitter = implementation_emitter.Emit( |
| 540 self._backend.ImplementationTemplate(), | 540 self._backend.ImplementationTemplate(), |
| 541 LIBRARYNAME='dart.dom.%s' % self._library_name, | 541 LIBRARYNAME='dart.dom.%s' % self._library_name, |
| 542 ANNOTATIONS=annotations, | 542 ANNOTATIONS=annotations, |
| 543 CLASS_MODIFIERS=class_modifiers, | 543 CLASS_MODIFIERS=class_modifiers, |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 member_name = '%s.%s' % (self._interface.doc_js_name, member_name) | 1039 member_name = '%s.%s' % (self._interface.doc_js_name, member_name) |
| 1040 return member_name in _js_custom_members | 1040 return member_name in _js_custom_members |
| 1041 | 1041 |
| 1042 def _RenamingAnnotation(self, idl_name, member_name): | 1042 def _RenamingAnnotation(self, idl_name, member_name): |
| 1043 if member_name != idl_name: | 1043 if member_name != idl_name: |
| 1044 return "@JSName('%s')\n " % idl_name | 1044 return "@JSName('%s')\n " % idl_name |
| 1045 return '' | 1045 return '' |
| 1046 | 1046 |
| 1047 def _Metadata(self, idl_type, idl_member_name, indent=' '): | 1047 def _Metadata(self, idl_type, idl_member_name, indent=' '): |
| 1048 anns = self._metadata.GetDart2JSMetadata( | 1048 anns = self._metadata.GetDart2JSMetadata( |
| 1049 idl_type, self._library_name, self._interface.id, idl_member_name) | 1049 idl_type, self._library_name, self._interface, idl_member_name) |
| 1050 | 1050 |
| 1051 if not self._metadata.AnyConversionAnnotations( | 1051 if not self._metadata.AnyConversionAnnotations( |
| 1052 idl_type, self._interface.id, idl_member_name): | 1052 idl_type, self._interface.id, idl_member_name): |
| 1053 return_type = self.SecureOutputType(idl_type) | 1053 return_type = self.SecureOutputType(idl_type) |
| 1054 native_type = self._NarrowToImplementationType(idl_type) | 1054 native_type = self._NarrowToImplementationType(idl_type) |
| 1055 if native_type != return_type: | 1055 if native_type != return_type: |
| 1056 anns = anns + [ | 1056 anns = anns + [ |
| 1057 "@Returns('%s')" % native_type, | 1057 "@Returns('%s')" % native_type, |
| 1058 "@Creates('%s')" % native_type, | 1058 "@Creates('%s')" % native_type, |
| 1059 ] | 1059 ] |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 for library_name in libraries: | 1167 for library_name in libraries: |
| 1168 self._libraries[library_name] = DartLibrary( | 1168 self._libraries[library_name] = DartLibrary( |
| 1169 library_name, template_loader, library_type, output_dir) | 1169 library_name, template_loader, library_type, output_dir) |
| 1170 | 1170 |
| 1171 def AddFile(self, basename, library_name, path): | 1171 def AddFile(self, basename, library_name, path): |
| 1172 self._libraries[library_name].AddFile(path) | 1172 self._libraries[library_name].AddFile(path) |
| 1173 | 1173 |
| 1174 def Emit(self, emitter, auxiliary_dir): | 1174 def Emit(self, emitter, auxiliary_dir): |
| 1175 for lib in self._libraries.values(): | 1175 for lib in self._libraries.values(): |
| 1176 lib.Emit(emitter, auxiliary_dir) | 1176 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |