| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 """Generates a typedef for the callback interface.""" | 444 """Generates a typedef for the callback interface.""" |
| 445 typedef_name = self._renamer.RenameInterface(self._interface) | 445 typedef_name = self._renamer.RenameInterface(self._interface) |
| 446 if not typedef_name: | 446 if not typedef_name: |
| 447 return | 447 return |
| 448 | 448 |
| 449 info = GetCallbackInfo(self._interface) | 449 info = GetCallbackInfo(self._interface) |
| 450 code = self._library_emitter.FileEmitter(self._interface.id, | 450 code = self._library_emitter.FileEmitter(self._interface.id, |
| 451 self._library_name) | 451 self._library_name) |
| 452 code.Emit(self._template_loader.Load('callback.darttemplate')) | 452 code.Emit(self._template_loader.Load('callback.darttemplate')) |
| 453 | 453 |
| 454 code.Emit('typedef void $NAME($PARAMS);\n', | 454 annotations = self._metadata.GetFormattedMetadata(self._library_name, |
| 455 LIBRARYNAME='dart.dom.%s' % self._library_name, | 455 self._interface) |
| 456 |
| 457 code.Emit('$(ANNOTATIONS)typedef void $NAME($PARAMS);\n', |
| 458 ANNOTATIONS=annotations, |
| 456 NAME=typedef_name, | 459 NAME=typedef_name, |
| 457 PARAMS=info.ParametersDeclaration(self._DartType)) | 460 PARAMS=info.ParametersDeclaration(self._DartType)) |
| 458 self._backend.GenerateCallback(info) | 461 self._backend.GenerateCallback(info) |
| 459 | 462 |
| 460 def GenerateInterface(self): | 463 def GenerateInterface(self): |
| 461 interface_name = self._interface_type_info.interface_name() | 464 interface_name = self._interface_type_info.interface_name() |
| 462 | 465 |
| 463 factory_provider = None | 466 factory_provider = None |
| 464 if interface_name in interface_factories: | 467 if interface_name in interface_factories: |
| 465 factory_provider = interface_factories[interface_name] | 468 factory_provider = interface_factories[interface_name] |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 for library_name in libraries: | 1174 for library_name in libraries: |
| 1172 self._libraries[library_name] = DartLibrary( | 1175 self._libraries[library_name] = DartLibrary( |
| 1173 library_name, template_loader, library_type, output_dir) | 1176 library_name, template_loader, library_type, output_dir) |
| 1174 | 1177 |
| 1175 def AddFile(self, basename, library_name, path): | 1178 def AddFile(self, basename, library_name, path): |
| 1176 self._libraries[library_name].AddFile(path) | 1179 self._libraries[library_name].AddFile(path) |
| 1177 | 1180 |
| 1178 def Emit(self, emitter, auxiliary_dir): | 1181 def Emit(self, emitter, auxiliary_dir): |
| 1179 for lib in self._libraries.values(): | 1182 for lib in self._libraries.values(): |
| 1180 lib.Emit(emitter, auxiliary_dir) | 1183 lib.Emit(emitter, auxiliary_dir) |
| OLD | NEW |