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, \ |
11 DartDomNameOfAttribute, FindMatchingAttribute, \ | 11 DartDomNameOfAttribute, FindMatchingAttribute, \ |
12 TypeOrNothing, ConvertToFuture, GetCallbackInfo | 12 TypeOrNothing, ConvertToFuture, GetCallbackInfo |
13 from copy import deepcopy | 13 from copy import deepcopy |
14 from htmlrenamer import convert_to_future_members, custom_html_constructors, \ | 14 from htmlrenamer import convert_to_future_members, custom_html_constructors, \ |
15 keep_overloaded_members, private_html_members, dom_private_html_members, ren
amed_html_members, \ | 15 keep_overloaded_members, private_html_members, renamed_html_members, \ |
16 renamed_overloads, removed_html_members | 16 renamed_overloads, removed_html_members |
17 import logging | 17 import logging |
18 import monitored | 18 import monitored |
19 import sys | 19 import sys |
20 | 20 |
21 _logger = logging.getLogger('htmldartgenerator') | 21 _logger = logging.getLogger('htmldartgenerator') |
22 | 22 |
23 # Types that are accessible cross-frame in a limited fashion. | 23 # Types that are accessible cross-frame in a limited fashion. |
24 # In these cases, the base type (e.g., WindowBase) provides restricted access | 24 # In these cases, the base type (e.g., WindowBase) provides restricted access |
25 # while the subtype (e.g., Window) provides full access to the | 25 # while the subtype (e.g., Window) provides full access to the |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 operation.id. If not, stop library generation, and throw an error, requiring | 196 operation.id. If not, stop library generation, and throw an error, requiring |
197 programmer input about the best name change before proceeding.""" | 197 programmer input about the best name change before proceeding.""" |
198 operation_str = '%s.%s' % (interface.id, operation.id) | 198 operation_str = '%s.%s' % (interface.id, operation.id) |
199 if (operation.id in operations_by_name and | 199 if (operation.id in operations_by_name and |
200 len(operations_by_name[operation.id]) > 1 and | 200 len(operations_by_name[operation.id]) > 1 and |
201 len(filter(lambda overload: overload.startswith(operation_str), | 201 len(filter(lambda overload: overload.startswith(operation_str), |
202 renamed_overloads.keys())) == 0 and | 202 renamed_overloads.keys())) == 0 and |
203 operation_str not in keep_overloaded_members and | 203 operation_str not in keep_overloaded_members and |
204 operation_str not in renamed_html_members and | 204 operation_str not in renamed_html_members and |
205 operation_str not in private_html_members and | 205 operation_str not in private_html_members and |
206 operation_str not in dom_private_html_members and | |
207 operation_str not in removed_html_members and | 206 operation_str not in removed_html_members and |
208 operation.id != '__getter__' and | 207 operation.id != '__getter__' and |
209 operation.id != '__setter__' and | 208 operation.id != '__setter__' and |
210 operation.id != '__delete__'): | 209 operation.id != '__delete__'): |
211 _logger.error('Multiple type signatures for %s.%s' % ( | 210 _logger.error('Multiple type signatures for %s.%s' % ( |
212 interface.id, operation.id)) | 211 interface.id, operation.id)) |
213 raise Exception('Rename one of the methods in renamed_overloads or add it' | 212 raise Exception('Rename one of the methods in renamed_overloads or add it' |
214 ' to keep_overloaded_members.\n' | 213 ' to keep_overloaded_members.\n' |
215 'Generation UNsuccessful.') | 214 'Generation UNsuccessful.') |
216 | 215 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 693 |
695 def SecureBaseName(self, type_name): | 694 def SecureBaseName(self, type_name): |
696 if type_name in _secure_base_types: | 695 if type_name in _secure_base_types: |
697 return _secure_base_types[type_name] | 696 return _secure_base_types[type_name] |
698 | 697 |
699 def _DartType(self, type_name): | 698 def _DartType(self, type_name): |
700 return self._type_registry.DartType(type_name) | 699 return self._type_registry.DartType(type_name) |
701 | 700 |
702 def _TypeInfo(self, type_name): | 701 def _TypeInfo(self, type_name): |
703 return self._type_registry.TypeInfo(type_name) | 702 return self._type_registry.TypeInfo(type_name) |
OLD | NEW |