| 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 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 factory_constructor_name - The name of the constructor on the | 470 factory_constructor_name - The name of the constructor on the |
| 471 factory_name to call (calls an autogenerated FactoryProvider | 471 factory_name to call (calls an autogenerated FactoryProvider |
| 472 if unspecified) | 472 if unspecified) |
| 473 """ | 473 """ |
| 474 for constructor_info in constructors: | 474 for constructor_info in constructors: |
| 475 self._AddConstructor( | 475 self._AddConstructor( |
| 476 constructor_info, factory_name, factory_constructor_name) | 476 constructor_info, factory_name, factory_constructor_name) |
| 477 | 477 |
| 478 def _AddConstructor(self, | 478 def _AddConstructor(self, |
| 479 constructor_info, factory_name, factory_constructor_name): | 479 constructor_info, factory_name, factory_constructor_name): |
| 480 # Hack to ignore the Image constructor used by JavaScript. |
| 481 if (self._interface.id == 'HTMLImageElement' |
| 482 and not constructor_info.pure_dart_constructor): |
| 483 return |
| 484 |
| 480 if self.GenerateCustomFactory(constructor_info): | 485 if self.GenerateCustomFactory(constructor_info): |
| 481 return | 486 return |
| 482 | 487 |
| 483 metadata = self._metadata.GetFormattedMetadata( | 488 metadata = self._metadata.GetFormattedMetadata( |
| 484 self._library_name, self._interface, self._interface.id, ' ') | 489 self._library_name, self._interface, self._interface.id, ' ') |
| 485 | 490 |
| 486 if not factory_constructor_name: | 491 if not factory_constructor_name: |
| 487 factory_constructor_name = '_create' | 492 factory_constructor_name = '_create' |
| 488 factory_parameters = constructor_info.ParametersAsArgumentList() | 493 factory_parameters = constructor_info.ParametersAsArgumentList() |
| 489 else: | 494 else: |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 706 |
| 702 def SecureBaseName(self, type_name): | 707 def SecureBaseName(self, type_name): |
| 703 if type_name in _secure_base_types: | 708 if type_name in _secure_base_types: |
| 704 return _secure_base_types[type_name] | 709 return _secure_base_types[type_name] |
| 705 | 710 |
| 706 def _DartType(self, type_name): | 711 def _DartType(self, type_name): |
| 707 return self._type_registry.DartType(type_name) | 712 return self._type_registry.DartType(type_name) |
| 708 | 713 |
| 709 def _TypeInfo(self, type_name): | 714 def _TypeInfo(self, type_name): |
| 710 return self._type_registry.TypeInfo(type_name) | 715 return self._type_registry.TypeInfo(type_name) |
| OLD | NEW |