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 os | 10 import os |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 arguments, | 228 arguments, |
229 self._interface.id, | 229 self._interface.id, |
230 'ConstructorRaisesException' in ext_attrs) | 230 'ConstructorRaisesException' in ext_attrs) |
231 | 231 |
232 def HasSupportCheck(self): | 232 def HasSupportCheck(self): |
233 # Need to omit a support check if it is conditional in JS. | 233 # Need to omit a support check if it is conditional in JS. |
234 return self._interface.doc_js_name in js_support_checks | 234 return self._interface.doc_js_name in js_support_checks |
235 | 235 |
236 def GetSupportCheck(self): | 236 def GetSupportCheck(self): |
237 # Assume that everything is supported on Dartium. | 237 # Assume that everything is supported on Dartium. |
238 return 'true' | 238 value = js_support_checks.get(self._interface.doc_js_name) |
| 239 if type(value) == tuple: |
| 240 return (value[0], 'true') |
| 241 else: |
| 242 return 'true' |
239 | 243 |
240 def FinishInterface(self): | 244 def FinishInterface(self): |
241 self._GenerateCPPHeader() | 245 self._GenerateCPPHeader() |
242 | 246 |
243 self._cpp_impl_emitter.Emit( | 247 self._cpp_impl_emitter.Emit( |
244 self._template_loader.Load('cpp_implementation.template'), | 248 self._template_loader.Load('cpp_implementation.template'), |
245 INTERFACE=self._interface.id, | 249 INTERFACE=self._interface.id, |
246 INCLUDES=self._GenerateCPPIncludes(self._cpp_impl_includes), | 250 INCLUDES=self._GenerateCPPIncludes(self._cpp_impl_includes), |
247 CALLBACKS=self._cpp_definitions_emitter.Fragments(), | 251 CALLBACKS=self._cpp_definitions_emitter.Fragments(), |
248 RESOLVER=self._cpp_resolver_emitter.Fragments(), | 252 RESOLVER=self._cpp_resolver_emitter.Fragments(), |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 895 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
892 ' return func;\n', | 896 ' return func;\n', |
893 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 897 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
894 | 898 |
895 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 899 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
896 return ( | 900 return ( |
897 interface.id.endswith('Event') and | 901 interface.id.endswith('Event') and |
898 operation.id.startswith('init') and | 902 operation.id.startswith('init') and |
899 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and | 903 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and |
900 argument.type.id == 'DOMString') | 904 argument.type.id == 'DOMString') |
OLD | NEW |