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 logging | 10 import logging |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 return self._type_registry.DartType(type_name) | 647 return self._type_registry.DartType(type_name) |
648 | 648 |
649 | 649 |
650 # ------------------------------------------------------------------------------ | 650 # ------------------------------------------------------------------------------ |
651 | 651 |
652 class Dart2JSBackend(HtmlDartGenerator): | 652 class Dart2JSBackend(HtmlDartGenerator): |
653 """Generates a dart2js class for the dart:html library from a DOM IDL | 653 """Generates a dart2js class for the dart:html library from a DOM IDL |
654 interface. | 654 interface. |
655 """ | 655 """ |
656 | 656 |
657 def __init__(self, interface, options): | 657 def __init__(self, interface, options, logging_level=logging.WARNING): |
658 super(Dart2JSBackend, self).__init__(interface, options, False) | 658 super(Dart2JSBackend, self).__init__(interface, options, False) |
659 | 659 |
660 self._database = options.database | 660 self._database = options.database |
661 self._template_loader = options.templates | 661 self._template_loader = options.templates |
662 self._type_registry = options.type_registry | 662 self._type_registry = options.type_registry |
663 self._renamer = options.renamer | 663 self._renamer = options.renamer |
664 self._metadata = options.metadata | 664 self._metadata = options.metadata |
665 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) | 665 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) |
666 self._current_secondary_parent = None | 666 self._current_secondary_parent = None |
667 self._library_name = self._renamer.GetLibraryName(self._interface) | 667 self._library_name = self._renamer.GetLibraryName(self._interface) |
668 | 668 |
| 669 _logger.setLevel(logging_level) |
| 670 |
669 def ImplementsMergedMembers(self): | 671 def ImplementsMergedMembers(self): |
670 return True | 672 return True |
671 | 673 |
672 def GenerateCallback(self, info): | 674 def GenerateCallback(self, info): |
673 pass | 675 pass |
674 | 676 |
675 def AdditionalImplementedInterfaces(self): | 677 def AdditionalImplementedInterfaces(self): |
676 implements = super(Dart2JSBackend, self).AdditionalImplementedInterfaces() | 678 implements = super(Dart2JSBackend, self).AdditionalImplementedInterfaces() |
677 if self._interface_type_info.list_item_type() and self.HasIndexedGetter(): | 679 if self._interface_type_info.list_item_type() and self.HasIndexedGetter(): |
678 implements.append('JavaScriptIndexingBehavior') | 680 implements.append('JavaScriptIndexingBehavior') |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 | 1269 |
1268 def AddFile(self, basename, library_name, path): | 1270 def AddFile(self, basename, library_name, path): |
1269 self._libraries[library_name].AddFile(path) | 1271 self._libraries[library_name].AddFile(path) |
1270 | 1272 |
1271 def AddTypeEntry(self, library_name, idl_name, dart_name): | 1273 def AddTypeEntry(self, library_name, idl_name, dart_name): |
1272 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) | 1274 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) |
1273 | 1275 |
1274 def Emit(self, emitter, auxiliary_dir): | 1276 def Emit(self, emitter, auxiliary_dir): |
1275 for lib in self._libraries.values(): | 1277 for lib in self._libraries.values(): |
1276 lib.Emit(emitter, auxiliary_dir) | 1278 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |