| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 'static void constructorCallback(Dart_NativeArguments args)\n' | 145 'static void constructorCallback(Dart_NativeArguments args)\n' |
| 146 '{\n' | 146 '{\n' |
| 147 ' WebCore::DartArrayBufferViewInternal::constructWebGLArray<Dart$(INT
ERFACE_NAME)>(args);\n' | 147 ' WebCore::DartArrayBufferViewInternal::constructWebGLArray<Dart$(INT
ERFACE_NAME)>(args);\n' |
| 148 '}\n', | 148 '}\n', |
| 149 INTERFACE_NAME=self._interface.id); | 149 INTERFACE_NAME=self._interface.id); |
| 150 | 150 |
| 151 def EmitHelpers(self, base_class): | 151 def EmitHelpers(self, base_class): |
| 152 # Emit internal constructor which is necessary for Dartium bindings | 152 # Emit internal constructor which is necessary for Dartium bindings |
| 153 # to construct wrappers from C++. Eventually it should go away | 153 # to construct wrappers from C++. Eventually it should go away |
| 154 # once it is possible to construct such an instance directly. | 154 # once it is possible to construct such an instance directly. |
| 155 if not self._members_emitter: |
| 156 return |
| 157 |
| 155 super_constructor = '' | 158 super_constructor = '' |
| 156 if base_class and base_class != 'NativeFieldWrapperClass1': | 159 if base_class and base_class != 'NativeFieldWrapperClass1': |
| 157 super_constructor = ' : super.internal()' | 160 super_constructor = ' : super.internal()' |
| 158 self._members_emitter.Emit( | 161 self._members_emitter.Emit( |
| 159 ' $CLASSNAME.internal()$SUPERCONSTRUCTOR;\n', | 162 ' $CLASSNAME.internal()$SUPERCONSTRUCTOR;\n', |
| 160 CLASSNAME=self._interface_type_info.implementation_name(), | 163 CLASSNAME=self._interface_type_info.implementation_name(), |
| 161 SUPERCONSTRUCTOR=super_constructor) | 164 SUPERCONSTRUCTOR=super_constructor) |
| 162 | 165 |
| 163 def _EmitConstructorInfrastructure(self, | 166 def _EmitConstructorInfrastructure(self, |
| 164 constructor_info, constructor_callback_cpp_name, factory_method_name, | 167 constructor_info, constructor_callback_cpp_name, factory_method_name, |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 919 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 917 ' return func;\n', | 920 ' return func;\n', |
| 918 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 921 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 919 | 922 |
| 920 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 923 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 921 return ( | 924 return ( |
| 922 interface.id.endswith('Event') and | 925 interface.id.endswith('Event') and |
| 923 operation.id.startswith('init') and | 926 operation.id.startswith('init') and |
| 924 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and | 927 argument.ext_attrs.get('Optional') == 'DefaultIsUndefined' and |
| 925 argument.type.id == 'DOMString') | 928 argument.type.id == 'DOMString') |
| OLD | NEW |