Chromium Code Reviews| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 implements.append(parent_type_info.interface_name()) | 511 implements.append(parent_type_info.interface_name()) |
| 512 | 512 |
| 513 secure_base_name = self._backend.SecureBaseName(interface_name) | 513 secure_base_name = self._backend.SecureBaseName(interface_name) |
| 514 if secure_base_name: | 514 if secure_base_name: |
| 515 implements.append(secure_base_name) | 515 implements.append(secure_base_name) |
| 516 | 516 |
| 517 implements_str = '' | 517 implements_str = '' |
| 518 if implements: | 518 if implements: |
| 519 implements_str = ' implements ' + ', '.join(set(implements)) | 519 implements_str = ' implements ' + ', '.join(set(implements)) |
| 520 | 520 |
| 521 mixins = self._backend.Mixins() | |
| 522 mixins_str = '' | |
| 523 if mixins: | |
| 524 mixins_str = ' with ' + ', '.join(set(mixins)) | |
|
sra1
2013/04/24 20:01:01
set(x) has undefined iteration order
Just do .joi
blois
2013/04/26 21:02:34
Done.
| |
| 525 if not base_class: | |
| 526 base_class = 'Object' | |
| 527 | |
| 521 annotations = FormatAnnotationsAndComments( | 528 annotations = FormatAnnotationsAndComments( |
| 522 GetAnnotationsAndComments(self._library_name, | 529 GetAnnotationsAndComments(self._library_name, |
| 523 self._interface.doc_js_name), '') | 530 self._interface.doc_js_name), '') |
| 524 | 531 |
| 525 class_modifiers = '' | 532 class_modifiers = '' |
| 526 if self._renamer.ShouldSuppressInterface(self._interface): | 533 if self._renamer.ShouldSuppressInterface(self._interface): |
| 527 class_modifiers = 'abstract ' | 534 class_modifiers = 'abstract ' |
| 528 | 535 |
| 529 self._implementation_members_emitter = implementation_emitter.Emit( | 536 self._implementation_members_emitter = implementation_emitter.Emit( |
| 530 self._backend.ImplementationTemplate(), | 537 self._backend.ImplementationTemplate(), |
| 531 LIBRARYNAME='dart.dom.%s' % self._library_name, | 538 LIBRARYNAME='dart.dom.%s' % self._library_name, |
| 532 ANNOTATIONS=annotations, | 539 ANNOTATIONS=annotations, |
| 533 CLASS_MODIFIERS=class_modifiers, | 540 CLASS_MODIFIERS=class_modifiers, |
| 534 CLASSNAME=self._interface_type_info.implementation_name(), | 541 CLASSNAME=self._interface_type_info.implementation_name(), |
| 535 EXTENDS=' extends %s' % base_class if base_class else '', | 542 EXTENDS=' extends %s' % base_class if base_class else '', |
| 536 IMPLEMENTS=implements_str, | 543 IMPLEMENTS=implements_str, |
| 544 MIXINS=mixins_str, | |
| 537 DOMNAME=self._interface.doc_js_name, | 545 DOMNAME=self._interface.doc_js_name, |
| 538 NATIVESPEC=self._backend.NativeSpec()) | 546 NATIVESPEC=self._backend.NativeSpec()) |
| 539 self._backend.StartInterface(self._implementation_members_emitter) | 547 self._backend.StartInterface(self._implementation_members_emitter) |
| 540 | 548 |
| 541 self._backend.EmitHelpers(base_class) | 549 self._backend.EmitHelpers(base_class) |
| 542 self._event_generator.EmitStreamProviders( | 550 self._event_generator.EmitStreamProviders( |
| 543 self._interface, | 551 self._interface, |
| 544 self._backend.CustomJSMembers(), | 552 self._backend.CustomJSMembers(), |
| 545 self._implementation_members_emitter, | 553 self._implementation_members_emitter, |
| 546 self._library_name) | 554 self._library_name) |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1159 for library_name in libraries: | 1167 for library_name in libraries: |
| 1160 self._libraries[library_name] = DartLibrary( | 1168 self._libraries[library_name] = DartLibrary( |
| 1161 library_name, template_loader, library_type, output_dir) | 1169 library_name, template_loader, library_type, output_dir) |
| 1162 | 1170 |
| 1163 def AddFile(self, basename, library_name, path): | 1171 def AddFile(self, basename, library_name, path): |
| 1164 self._libraries[library_name].AddFile(path) | 1172 self._libraries[library_name].AddFile(path) |
| 1165 | 1173 |
| 1166 def Emit(self, emitter, auxiliary_dir): | 1174 def Emit(self, emitter, auxiliary_dir): |
| 1167 for lib in self._libraries.values(): | 1175 for lib in self._libraries.values(): |
| 1168 lib.Emit(emitter, auxiliary_dir) | 1176 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |