| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ' static PassRefPtr<NativeType> toNative(Dart_Handle handle, Dart_H
andle& exception);\n') | 360 ' static PassRefPtr<NativeType> toNative(Dart_Handle handle, Dart_H
andle& exception);\n') |
| 361 else: | 361 else: |
| 362 to_native_emitter.Emit( | 362 to_native_emitter.Emit( |
| 363 ' static NativeType* toNative(Dart_Handle handle, Dart_Handle& exce
ption)\n' | 363 ' static NativeType* toNative(Dart_Handle handle, Dart_Handle& exce
ption)\n' |
| 364 ' {\n' | 364 ' {\n' |
| 365 ' return DartDOMWrapper::unwrapDartWrapper<Dart$INTERFACE>(hand
le, exception);\n' | 365 ' return DartDOMWrapper::unwrapDartWrapper<Dart$INTERFACE>(hand
le, exception);\n' |
| 366 ' }\n', | 366 ' }\n', |
| 367 INTERFACE=self._interface.id) | 367 INTERFACE=self._interface.id) |
| 368 | 368 |
| 369 to_dart_emitter = emitter.Emitter() | 369 to_dart_emitter = emitter.Emitter() |
| 370 if ('CustomToJS' in self._interface.ext_attrs or | 370 |
| 371 'CustomToJSObject' in self._interface.ext_attrs or | 371 ext_attrs = self._interface.ext_attrs |
| 372 'PureInterface' in self._interface.ext_attrs or | 372 |
| 373 'CPPPureInterface' in self._interface.ext_attrs or | 373 if ('CustomToJS' in ext_attrs or |
| 374 ('CustomToJSObject' in ext_attrs and 'TypedArray' not in ext_attrs) or |
| 375 'PureInterface' in ext_attrs or |
| 376 'CPPPureInterface' in ext_attrs or |
| 374 self._interface_type_info.custom_to_dart()): | 377 self._interface_type_info.custom_to_dart()): |
| 375 to_dart_emitter.Emit( | 378 to_dart_emitter.Emit( |
| 376 ' static Dart_Handle toDart(NativeType* value);\n') | 379 ' static Dart_Handle toDart(NativeType* value);\n') |
| 377 else: | 380 else: |
| 378 to_dart_emitter.Emit( | 381 to_dart_emitter.Emit( |
| 379 ' static Dart_Handle toDart(NativeType* value)\n' | 382 ' static Dart_Handle toDart(NativeType* value)\n' |
| 380 ' {\n' | 383 ' {\n' |
| 381 ' return DartDOMWrapper::toDart<Dart$(INTERFACE)>(value);\n' | 384 ' return DartDOMWrapper::toDart<Dart$(INTERFACE)>(value);\n' |
| 382 ' }\n', | 385 ' }\n', |
| 383 INTERFACE=self._interface.id) | 386 INTERFACE=self._interface.id) |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 parent_interface = _FindInHierarchy(database, parent_interface, test) | 947 parent_interface = _FindInHierarchy(database, parent_interface, test) |
| 945 if parent_interface: | 948 if parent_interface: |
| 946 return parent_interface | 949 return parent_interface |
| 947 | 950 |
| 948 def _ToWebKitName(name): | 951 def _ToWebKitName(name): |
| 949 name = name[0].lower() + name[1:] | 952 name = name[0].lower() + name[1:] |
| 950 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), | 953 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), |
| 951 name) | 954 name) |
| 952 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, | 955 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, |
| 953 name) | 956 name) |
| OLD | NEW |