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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 self._cpp_declarations_emitter.Emit( | 301 self._cpp_declarations_emitter.Emit( |
302 '\n' | 302 '\n' |
303 'void $CPP_CALLBACK(Dart_NativeArguments);\n', | 303 'void $CPP_CALLBACK(Dart_NativeArguments);\n', |
304 CPP_CALLBACK=constructor_callback_cpp_name) | 304 CPP_CALLBACK=constructor_callback_cpp_name) |
305 | 305 |
306 return True | 306 return True |
307 | 307 |
308 def IsConstructorArgumentOptional(self, argument): | 308 def IsConstructorArgumentOptional(self, argument): |
309 return IsOptional(argument) | 309 return IsOptional(argument) |
310 | 310 |
311 def MakeFactoryCall(self, factory, method, arguments, constructor_info): | |
312 return emitter.Format( | |
313 '$FACTORY.$METHOD($ARGUMENTS)', | |
314 FACTORY=factory, | |
315 METHOD=method, | |
316 ARGUMENTS=arguments) | |
317 | |
318 def EmitStaticFactoryOverload(self, constructor_info, name, arguments): | 311 def EmitStaticFactoryOverload(self, constructor_info, name, arguments): |
319 constructor_callback_cpp_name = name + 'constructorCallback' | 312 constructor_callback_cpp_name = name + 'constructorCallback' |
320 self._EmitConstructorInfrastructure( | 313 self._EmitConstructorInfrastructure( |
321 constructor_info, name, 'constructorCallback', name, arguments, | 314 constructor_info, name, 'constructorCallback', name, arguments, |
322 emit_to_native=True, | 315 emit_to_native=True, |
323 is_custom=False) | 316 is_custom=False) |
324 | 317 |
325 ext_attrs = self._interface.ext_attrs | 318 ext_attrs = self._interface.ext_attrs |
326 | 319 |
327 create_function = 'create' | 320 create_function = 'create' |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 | 1248 |
1256 def _IsCustom(op_or_attr): | 1249 def _IsCustom(op_or_attr): |
1257 assert(isinstance(op_or_attr, IDLMember)) | 1250 assert(isinstance(op_or_attr, IDLMember)) |
1258 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 |
1259 | 1252 |
1260 def _IsCustomValue(op_or_attr, value): | 1253 def _IsCustomValue(op_or_attr, value): |
1261 if _IsCustom(op_or_attr): | 1254 if _IsCustom(op_or_attr): |
1262 return op_or_attr.ext_attrs.get('Custom') == value \ | 1255 return op_or_attr.ext_attrs.get('Custom') == value \ |
1263 or op_or_attr.ext_attrs.get('DartCustom') == value | 1256 or op_or_attr.ext_attrs.get('DartCustom') == value |
1264 return False | 1257 return False |
OLD | NEW |