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 systems to generate | 6 """This module provides shared functionality for systems to generate |
7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
8 | 8 |
9 import copy | 9 import copy |
10 import re | 10 import re |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if element_type: | 132 if element_type: |
133 return element_type | 133 return element_type |
134 | 134 |
135 return None | 135 return None |
136 | 136 |
137 def MakeNativeSpec(javascript_binding_name): | 137 def MakeNativeSpec(javascript_binding_name): |
138 if javascript_binding_name in _dart2js_dom_custom_native_specs: | 138 if javascript_binding_name in _dart2js_dom_custom_native_specs: |
139 return _dart2js_dom_custom_native_specs[javascript_binding_name] | 139 return _dart2js_dom_custom_native_specs[javascript_binding_name] |
140 else: | 140 else: |
141 # Make the class 'hidden' so it is dynamically patched at runtime. This | 141 # Make the class 'hidden' so it is dynamically patched at runtime. This |
142 # is useful not only for browser compat, but to allow code that links | 142 # is useful for browser compat. |
143 # against dart:dom_deprecated to load in a worker isolate. | |
144 return '*' + javascript_binding_name | 143 return '*' + javascript_binding_name |
145 | 144 |
146 | 145 |
147 def MatchSourceFilter(thing): | 146 def MatchSourceFilter(thing): |
148 return 'WebKit' in thing.annotations or 'Dart' in thing.annotations | 147 return 'WebKit' in thing.annotations or 'Dart' in thing.annotations |
149 | 148 |
150 | 149 |
151 def DartType(idl_type_name): | 150 def DartType(idl_type_name): |
152 if idl_type_name in _idl_type_registry: | 151 if idl_type_name in _idl_type_registry: |
153 return _idl_type_registry[idl_type_name].dart_type or idl_type_name | 152 return _idl_type_registry[idl_type_name].dart_type or idl_type_name |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 if match: | 874 if match: |
876 if type_name == 'DOMString[]': | 875 if type_name == 'DOMString[]': |
877 return DOMStringArrayTypeInfo(TypeData('Sequence'), self.TypeInfo('DOMSt
ring')) | 876 return DOMStringArrayTypeInfo(TypeData('Sequence'), self.TypeInfo('DOMSt
ring')) |
878 item_info = self.TypeInfo(match.group(1) or match.group(2)) | 877 item_info = self.TypeInfo(match.group(1) or match.group(2)) |
879 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) | 878 return SequenceIDLTypeInfo(type_name, TypeData('Sequence'), item_info) |
880 if not type_name in _idl_type_registry: | 879 if not type_name in _idl_type_registry: |
881 return InterfaceIDLTypeInfo(type_name, TypeData('Interface')) | 880 return InterfaceIDLTypeInfo(type_name, TypeData('Interface')) |
882 type_data = _idl_type_registry.get(type_name) | 881 type_data = _idl_type_registry.get(type_name) |
883 class_name = '%sIDLTypeInfo' % type_data.clazz | 882 class_name = '%sIDLTypeInfo' % type_data.clazz |
884 return globals()[class_name](type_name, type_data) | 883 return globals()[class_name](type_name, type_data) |
OLD | NEW |