| 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 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 9 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| 10 DartDomNameOfAttribute, FindMatchingAttribute, IsDartCollectionType, \ | 10 DartDomNameOfAttribute, FindMatchingAttribute, IsDartCollectionType, \ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class HtmlDartGenerator(object): | 24 class HtmlDartGenerator(object): |
| 25 def __init__(self, interface, options): | 25 def __init__(self, interface, options): |
| 26 self._database = options.database | 26 self._database = options.database |
| 27 self._interface = interface | 27 self._interface = interface |
| 28 self._type_registry = options.type_registry | 28 self._type_registry = options.type_registry |
| 29 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) | 29 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) |
| 30 self._renamer = options.renamer | 30 self._renamer = options.renamer |
| 31 | 31 |
| 32 def EmitSupportCheck(self): | 32 def EmitSupportCheck(self): |
| 33 if self.HasSupportCheck(): | 33 if self.HasSupportCheck(): |
| 34 support_check = self.GetSupportCheck() | 34 check = self.GetSupportCheck() |
| 35 if type(check) != tuple: |
| 36 signature = 'get supported' |
| 37 else: |
| 38 signature = check[0] |
| 39 check = check[1] |
| 35 self._members_emitter.Emit('\n' | 40 self._members_emitter.Emit('\n' |
| 36 ' /// Checks if this type is supported on the current platform.\n' | 41 ' /// Checks if this type is supported on the current platform.\n' |
| 37 ' static bool get supported => $SUPPORT_CHECK;\n', | 42 ' static bool $SIGNATURE => $SUPPORT_CHECK;\n', |
| 38 SUPPORT_CHECK=support_check) | 43 SIGNATURE=signature, SUPPORT_CHECK=check) |
| 39 | 44 |
| 40 def EmitEventGetter(self, events_class_name): | 45 def EmitEventGetter(self, events_class_name): |
| 41 self._members_emitter.Emit( | 46 self._members_emitter.Emit( |
| 42 "\n @DocsEditable" | 47 "\n @DocsEditable" |
| 43 "\n @DomName('EventTarget.addEventListener, " | 48 "\n @DomName('EventTarget.addEventListener, " |
| 44 "EventTarget.removeEventListener, EventTarget.dispatchEvent')" | 49 "EventTarget.removeEventListener, EventTarget.dispatchEvent')" |
| 45 "\n @deprecated" | 50 "\n @deprecated" |
| 46 "\n $TYPE get on =>\n new $TYPE(this);\n", | 51 "\n $TYPE get on =>\n new $TYPE(this);\n", |
| 47 TYPE=events_class_name) | 52 TYPE=events_class_name) |
| 48 | 53 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 walk(interface.parents) | 478 walk(interface.parents) |
| 474 else: | 479 else: |
| 475 walk(interface.parents[1:]) | 480 walk(interface.parents[1:]) |
| 476 return result | 481 return result |
| 477 | 482 |
| 478 def _DartType(self, type_name): | 483 def _DartType(self, type_name): |
| 479 return self._type_registry.DartType(type_name) | 484 return self._type_registry.DartType(type_name) |
| 480 | 485 |
| 481 def _IsPrivate(self, name): | 486 def _IsPrivate(self, name): |
| 482 return name.startswith('_') | 487 return name.startswith('_') |
| OLD | NEW |