| 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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 invocation_template = emitter.Format( | 932 invocation_template = emitter.Format( |
| 933 ' ExceptionCode ec = 0;\n' | 933 ' ExceptionCode ec = 0;\n' |
| 934 '$INVOCATION' | 934 '$INVOCATION' |
| 935 ' if (UNLIKELY(ec)) {\n' | 935 ' if (UNLIKELY(ec)) {\n' |
| 936 ' exception = DartDOMWrapper::exceptionCodeToDartException(
ec);\n' | 936 ' exception = DartDOMWrapper::exceptionCodeToDartException(
ec);\n' |
| 937 ' goto fail;\n' | 937 ' goto fail;\n' |
| 938 ' }\n', | 938 ' }\n', |
| 939 INVOCATION=invocation_template) | 939 INVOCATION=invocation_template) |
| 940 | 940 |
| 941 if 'ImplementedBy' in attributes: | 941 if 'ImplementedBy' in attributes: |
| 942 arguments.insert(0, 'receiver') | 942 # FIXME: rather ugly way to solve the problem. |
| 943 index = 1 if 'ScriptExecutionContext' == attributes.get('CallWith') else 0 |
| 944 arguments.insert(index, 'receiver') |
| 943 self._cpp_impl_includes.add('"%s.h"' % attributes['ImplementedBy']) | 945 self._cpp_impl_includes.add('"%s.h"' % attributes['ImplementedBy']) |
| 944 | 946 |
| 945 return emitter.Format(invocation_template, | 947 return emitter.Format(invocation_template, |
| 946 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments))) | 948 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments))) |
| 947 | 949 |
| 948 def _TypeInfo(self, type_name): | 950 def _TypeInfo(self, type_name): |
| 949 return self._system._type_registry.TypeInfo(type_name) | 951 return self._system._type_registry.TypeInfo(type_name) |
| 950 | 952 |
| 951 | 953 |
| 952 def _GenerateCPPIncludes(includes): | 954 def _GenerateCPPIncludes(includes): |
| (...skipping 13 matching lines...) Expand all Loading... |
| 966 | 968 |
| 967 def _IsArgumentOptionalInWebCore(argument): | 969 def _IsArgumentOptionalInWebCore(argument): |
| 968 return IsOptional(argument) and not 'Callback' in argument.ext_attrs | 970 return IsOptional(argument) and not 'Callback' in argument.ext_attrs |
| 969 | 971 |
| 970 def _ToWebKitName(name): | 972 def _ToWebKitName(name): |
| 971 name = name[0].lower() + name[1:] | 973 name = name[0].lower() + name[1:] |
| 972 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), | 974 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), |
| 973 name) | 975 name) |
| 974 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, | 976 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, |
| 975 name) | 977 name) |
| OLD | NEW |