| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 declaration, | 335 declaration, |
| 336 GenerateCall, | 336 GenerateCall, |
| 337 IsOptional, | 337 IsOptional, |
| 338 can_omit_type_check) | 338 can_omit_type_check) |
| 339 | 339 |
| 340 def AdditionalImplementedInterfaces(self): | 340 def AdditionalImplementedInterfaces(self): |
| 341 # TODO: Include all implemented interfaces, including other Lists. | 341 # TODO: Include all implemented interfaces, including other Lists. |
| 342 implements = [] | 342 implements = [] |
| 343 if self._interface_type_info.is_typed_array(): | 343 if self._interface_type_info.is_typed_array(): |
| 344 element_type = self._interface_type_info.list_item_type() | 344 element_type = self._interface_type_info.list_item_type() |
| 345 implements.append('List<%s>' % self._DartType(element_type)) | 345 implements.append('List<%s>' % element_type) |
| 346 if self._interface_type_info.list_item_type(): | 346 elif self._interface_type_info.list_item_type(): |
| 347 item_type_info = self._type_registry.TypeInfo( | 347 item_type_info = self._type_registry.TypeInfo( |
| 348 self._interface_type_info.list_item_type()) | 348 self._interface_type_info.list_item_type()) |
| 349 implements.append('List<%s>' % item_type_info.dart_type()) | 349 implements.append('List<%s>' % item_type_info.dart_type()) |
| 350 return implements | 350 return implements |
| 351 | 351 |
| 352 def AddConstructors(self, | 352 def AddConstructors(self, |
| 353 constructors, factory_name, factory_constructor_name): | 353 constructors, factory_name, factory_constructor_name): |
| 354 """ Adds all of the constructors. | 354 """ Adds all of the constructors. |
| 355 Arguments: | 355 Arguments: |
| 356 constructors - List of the constructors to be added. | 356 constructors - List of the constructors to be added. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 walk(interface.parents) | 651 walk(interface.parents) |
| 652 else: | 652 else: |
| 653 walk(interface.parents[1:]) | 653 walk(interface.parents[1:]) |
| 654 return result | 654 return result |
| 655 | 655 |
| 656 def _DartType(self, type_name): | 656 def _DartType(self, type_name): |
| 657 return self._type_registry.DartType(type_name) | 657 return self._type_registry.DartType(type_name) |
| 658 | 658 |
| 659 def _IsPrivate(self, name): | 659 def _IsPrivate(self, name): |
| 660 return name.startswith('_') | 660 return name.startswith('_') |
| OLD | NEW |