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 systems to generate | 6 """This module provides shared functionality for the systems to generate |
7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
8 | 8 |
9 import emitter | 9 import emitter |
10 import logging | 10 import logging |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 def CustomJSMembers(self): | 110 def CustomJSMembers(self): |
111 return {} | 111 return {} |
112 | 112 |
113 def _OutputConversion(self, idl_type, member): | 113 def _OutputConversion(self, idl_type, member): |
114 conversion = FindConversion(idl_type, 'get', self._interface.id, member) | 114 conversion = FindConversion(idl_type, 'get', self._interface.id, member) |
115 # TODO(jacobr) handle promise consistently in dart2js and dartium. | 115 # TODO(jacobr) handle promise consistently in dart2js and dartium. |
116 if idl_type == 'Promise': | 116 if idl_type == 'Promise': |
117 return _promise_to_future | 117 return _promise_to_future |
118 if conversion: | 118 if conversion: |
119 if conversion.function_name in ('_convertNativeToDart_Window', '_convertNa
tiveToDart_EventTarget', 'convertNativeToDart_DateTime', 'convertNativeToDart_Im
ageData'): | 119 if conversion.function_name in ('convertNativeToDart_DateTime', 'convertNa
tiveToDart_ImageData'): |
120 return None | 120 return None |
121 return conversion | 121 return conversion |
122 | 122 |
123 def _InputConversion(self, idl_type, member): | 123 def _InputConversion(self, idl_type, member): |
124 return FindConversion(idl_type, 'set', self._interface.id, member) | 124 return FindConversion(idl_type, 'set', self._interface.id, member) |
125 | 125 |
126 def GenerateCallback(self, info): | 126 def GenerateCallback(self, info): |
127 return None | 127 return None |
128 | 128 |
129 def ImplementationTemplate(self): | 129 def ImplementationTemplate(self): |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 | 1248 |
1249 def _IsCustom(op_or_attr): | 1249 def _IsCustom(op_or_attr): |
1250 assert(isinstance(op_or_attr, IDLMember)) | 1250 assert(isinstance(op_or_attr, IDLMember)) |
1251 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 1251 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
1252 | 1252 |
1253 def _IsCustomValue(op_or_attr, value): | 1253 def _IsCustomValue(op_or_attr, value): |
1254 if _IsCustom(op_or_attr): | 1254 if _IsCustom(op_or_attr): |
1255 return op_or_attr.ext_attrs.get('Custom') == value \ | 1255 return op_or_attr.ext_attrs.get('Custom') == value \ |
1256 or op_or_attr.ext_attrs.get('DartCustom') == value | 1256 or op_or_attr.ext_attrs.get('DartCustom') == value |
1257 return False | 1257 return False |
OLD | NEW |