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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 native_binding = '%s_constructor_Callback' % self._interface.id | 202 native_binding = '%s_constructor_Callback' % self._interface.id |
203 emitter.Emit( | 203 emitter.Emit( |
204 template, | 204 template, |
205 FACTORYPROVIDER=factory_provider, | 205 FACTORYPROVIDER=factory_provider, |
206 INTERFACE=interface_name, | 206 INTERFACE=interface_name, |
207 PARAMETERS=constructor_info.ParametersDeclaration(self._DartType), | 207 PARAMETERS=constructor_info.ParametersDeclaration(self._DartType), |
208 ARGUMENTS=constructor_info.ParametersAsArgumentList(), | 208 ARGUMENTS=constructor_info.ParametersAsArgumentList(), |
209 NATIVE_NAME=native_binding) | 209 NATIVE_NAME=native_binding) |
210 | 210 |
211 def AddConstructors(self, constructors, factory_name, class_name, | 211 def AddConstructors(self, constructors, factory_provider, class_name, |
212 base_class, factory_constructor_name=None): | 212 base_class): |
213 super(DartiumBackend, self).AddConstructors(constructors, factory_name, | 213 super(DartiumBackend, self).AddConstructors(constructors, factory_provider, |
214 class_name, base_class, factory_constructor_name) | 214 class_name, base_class) |
215 | 215 |
216 super_constructor = '' | 216 super_constructor = '' |
217 if base_class and base_class != 'NativeFieldWrapperClass1': | 217 if base_class and base_class != 'NativeFieldWrapperClass1': |
218 super_constructor = ': super.internal()' | 218 super_constructor = ': super.internal()' |
219 | 219 |
220 self._members_emitter.Emit( | 220 self._members_emitter.Emit( |
221 ' $CLASSNAME.internal()$SUPERCONSTRUCTOR;\n', | 221 ' $CLASSNAME.internal()$SUPERCONSTRUCTOR;\n', |
222 CLASSNAME=class_name, | 222 CLASSNAME=class_name, |
223 SUPERCONSTRUCTOR=super_constructor) | 223 SUPERCONSTRUCTOR=super_constructor) |
224 | 224 |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 def EmitResolver(self, template, output_dir): | 889 def EmitResolver(self, template, output_dir): |
890 file_path = os.path.join(output_dir, 'DartResolver.cpp') | 890 file_path = os.path.join(output_dir, 'DartResolver.cpp') |
891 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(
template) | 891 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(
template) |
892 for header_file in self._headers_list: | 892 for header_file in self._headers_list: |
893 path = os.path.relpath(header_file, output_dir) | 893 path = os.path.relpath(header_file, output_dir) |
894 includes_emitter.Emit('#include "$PATH"\n', PATH=path) | 894 includes_emitter.Emit('#include "$PATH"\n', PATH=path) |
895 body_emitter.Emit( | 895 body_emitter.Emit( |
896 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume
ntCount))\n' | 896 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume
ntCount))\n' |
897 ' return func;\n', | 897 ' return func;\n', |
898 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 898 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
OLD | NEW |