| 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 |
| 311 def EmitStaticFactoryOverload(self, constructor_info, name, arguments): | 318 def EmitStaticFactoryOverload(self, constructor_info, name, arguments): |
| 312 constructor_callback_cpp_name = name + 'constructorCallback' | 319 constructor_callback_cpp_name = name + 'constructorCallback' |
| 313 self._EmitConstructorInfrastructure( | 320 self._EmitConstructorInfrastructure( |
| 314 constructor_info, name, 'constructorCallback', name, arguments, | 321 constructor_info, name, 'constructorCallback', name, arguments, |
| 315 emit_to_native=True, | 322 emit_to_native=True, |
| 316 is_custom=False) | 323 is_custom=False) |
| 317 | 324 |
| 318 ext_attrs = self._interface.ext_attrs | 325 ext_attrs = self._interface.ext_attrs |
| 319 | 326 |
| 320 create_function = 'create' | 327 create_function = 'create' |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1255 |
| 1249 def _IsCustom(op_or_attr): | 1256 def _IsCustom(op_or_attr): |
| 1250 assert(isinstance(op_or_attr, IDLMember)) | 1257 assert(isinstance(op_or_attr, IDLMember)) |
| 1251 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 1258 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
| 1252 | 1259 |
| 1253 def _IsCustomValue(op_or_attr, value): | 1260 def _IsCustomValue(op_or_attr, value): |
| 1254 if _IsCustom(op_or_attr): | 1261 if _IsCustom(op_or_attr): |
| 1255 return op_or_attr.ext_attrs.get('Custom') == value \ | 1262 return op_or_attr.ext_attrs.get('Custom') == value \ |
| 1256 or op_or_attr.ext_attrs.get('DartCustom') == value | 1263 or op_or_attr.ext_attrs.get('DartCustom') == value |
| 1257 return False | 1264 return False |
| OLD | NEW |