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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 # returned in generated code. | 779 # returned in generated code. |
780 assert(dart_name != 'HistoryBase' and dart_name != 'LocationBase') | 780 assert(dart_name != 'HistoryBase' and dart_name != 'LocationBase') |
781 if dart_name == 'Window': | 781 if dart_name == 'Window': |
782 return _secure_base_types[dart_name] | 782 return _secure_base_types[dart_name] |
783 return dart_name | 783 return dart_name |
784 | 784 |
785 def SecureBaseName(self, type_name): | 785 def SecureBaseName(self, type_name): |
786 if type_name in _secure_base_types: | 786 if type_name in _secure_base_types: |
787 return _secure_base_types[type_name] | 787 return _secure_base_types[type_name] |
788 | 788 |
| 789 def is_DOM_type(self, type_name): |
| 790 try: |
| 791 self._type_registry.TypeInfo(type_name) |
| 792 return True |
| 793 except RuntimeError: |
| 794 return False |
| 795 |
789 def _NarrowToImplementationType(self, type_name): | 796 def _NarrowToImplementationType(self, type_name): |
790 return self._type_registry.TypeInfo(type_name).narrow_dart_type() | 797 return self._type_registry.TypeInfo(type_name).narrow_dart_type() |
791 | 798 |
792 def _NarrowInputType(self, type_name): | 799 def _NarrowInputType(self, type_name): |
793 return self._NarrowToImplementationType(type_name) | 800 return self._NarrowToImplementationType(type_name) |
794 | 801 |
795 def _DartType(self, type_name): | 802 def _DartType(self, type_name): |
796 return self._type_registry.DartType(type_name) | 803 return self._type_registry.DartType(type_name) |
797 | 804 |
798 def _TypeInfo(self, type_name): | 805 def _TypeInfo(self, type_name): |
799 return self._type_registry.TypeInfo(type_name) | 806 return self._type_registry.TypeInfo(type_name) |
OLD | NEW |