| 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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 | 1053 |
| 1054 if 'ImplementedBy' in attributes: | 1054 if 'ImplementedBy' in attributes: |
| 1055 arguments.insert(0, 'receiver') | 1055 arguments.insert(0, 'receiver') |
| 1056 self._cpp_impl_includes.add('"%s.h"' % attributes['ImplementedBy']) | 1056 self._cpp_impl_includes.add('"%s.h"' % attributes['ImplementedBy']) |
| 1057 | 1057 |
| 1058 return emitter.Format(invocation_template, | 1058 return emitter.Format(invocation_template, |
| 1059 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments))) | 1059 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments))) |
| 1060 | 1060 |
| 1061 | 1061 |
| 1062 def _GenerateCPPIncludes(includes): | 1062 def _GenerateCPPIncludes(includes): |
| 1063 return ''.join(['#include %s\n' % include for include in includes]) | 1063 return ''.join(['#include %s\n' % include for include in sorted(includes)]) |
| 1064 | 1064 |
| 1065 def _DOMWrapperType(database, interface): | 1065 def _DOMWrapperType(database, interface): |
| 1066 if interface.id == 'MessagePort': | 1066 if interface.id == 'MessagePort': |
| 1067 return 'MessagePort' | 1067 return 'MessagePort' |
| 1068 | 1068 |
| 1069 type = 'Object' | 1069 type = 'Object' |
| 1070 def is_node(interface): | 1070 def is_node(interface): |
| 1071 return interface.id == 'Node' | 1071 return interface.id == 'Node' |
| 1072 if is_node(interface) or _FindParent(interface, database, is_node): | 1072 if is_node(interface) or _FindParent(interface, database, is_node): |
| 1073 type = 'Node' | 1073 type = 'Node' |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1089 | 1089 |
| 1090 def _IsArgumentOptionalInWebCore(argument): | 1090 def _IsArgumentOptionalInWebCore(argument): |
| 1091 return IsOptional(argument) and not 'Callback' in argument.ext_attrs | 1091 return IsOptional(argument) and not 'Callback' in argument.ext_attrs |
| 1092 | 1092 |
| 1093 def _ToWebKitName(name): | 1093 def _ToWebKitName(name): |
| 1094 name = name[0].lower() + name[1:] | 1094 name = name[0].lower() + name[1:] |
| 1095 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), | 1095 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), |
| 1096 name) | 1096 name) |
| 1097 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, | 1097 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, |
| 1098 name) | 1098 name) |
| OLD | NEW |