| 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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 INDEX=len(arguments) + 1) | 798 INDEX=len(arguments) + 1) |
| 799 | 799 |
| 800 # Emit arguments. | 800 # Emit arguments. |
| 801 start_index = 1 if needs_receiver else 0 | 801 start_index = 1 if needs_receiver else 0 |
| 802 for i, argument in enumerate(arguments): | 802 for i, argument in enumerate(arguments): |
| 803 type_info = self._TypeInfo(argument.type.id) | 803 type_info = self._TypeInfo(argument.type.id) |
| 804 self._cpp_impl_includes |= set(type_info.to_native_includes()) | 804 self._cpp_impl_includes |= set(type_info.to_native_includes()) |
| 805 cpp_arguments.append(type_info.emit_to_native( | 805 cpp_arguments.append(type_info.emit_to_native( |
| 806 body_emitter, | 806 body_emitter, |
| 807 argument, | 807 argument, |
| 808 (IsOptional(argument) and not self._IsArgumentOptionalInWebCore(node,
argument)) or (argument.ext_attrs.get('Optional') == 'DefaultIsNullString'), | 808 IsOptional(argument) and not self._IsArgumentOptionalInWebCore(node, a
rgument), |
| 809 # TODO(antonm): all IDs should be renamed when database is generated. | 809 # TODO(antonm): all IDs should be renamed when database is generated. |
| 810 # That will allow to get rid of argument_name argument altogether. | 810 # That will allow to get rid of argument_name argument altogether. |
| 811 DartDomNameOfAttribute(argument), | 811 DartDomNameOfAttribute(argument), |
| 812 'Dart_GetNativeArgument(args, %i)' % (start_index + i), | 812 'Dart_GetNativeArgument(args, %i)' % (start_index + i), |
| 813 self._interface.id)) | 813 self._interface.id)) |
| 814 | 814 |
| 815 body_emitter.Emit('\n') | 815 body_emitter.Emit('\n') |
| 816 | 816 |
| 817 if 'NeedsUserGestureCheck' in ext_attrs: | 817 if 'NeedsUserGestureCheck' in ext_attrs: |
| 818 cpp_arguments.append('DartUtilities::processingUserGesture'); | 818 cpp_arguments.append('DartUtilities::processingUserGesture'); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 parent_interface = _FindInHierarchy(database, parent_interface, test) | 920 parent_interface = _FindInHierarchy(database, parent_interface, test) |
| 921 if parent_interface: | 921 if parent_interface: |
| 922 return parent_interface | 922 return parent_interface |
| 923 | 923 |
| 924 def _ToWebKitName(name): | 924 def _ToWebKitName(name): |
| 925 name = name[0].lower() + name[1:] | 925 name = name[0].lower() + name[1:] |
| 926 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), | 926 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), |
| 927 name) | 927 name) |
| 928 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, | 928 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, |
| 929 name) | 929 name) |
| OLD | NEW |