| 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 if not IsOptional(argument): | 800 if not IsOptional(argument): |
| 801 return False | 801 return False |
| 802 if 'Callback' in argument.ext_attrs: | 802 if 'Callback' in argument.ext_attrs: |
| 803 return False | 803 return False |
| 804 if operation.id in ['addEventListener', 'removeEventListener'] and argument.
id == 'useCapture': | 804 if operation.id in ['addEventListener', 'removeEventListener'] and argument.
id == 'useCapture': |
| 805 return False | 805 return False |
| 806 # Another option would be to adjust in IDLs, but let's keep it here for now | 806 # Another option would be to adjust in IDLs, but let's keep it here for now |
| 807 # as it's a single instance. | 807 # as it's a single instance. |
| 808 if self._interface.id == 'CSSStyleDeclaration' and operation.id == 'setPrope
rty' and argument.id == 'priority': | 808 if self._interface.id == 'CSSStyleDeclaration' and operation.id == 'setPrope
rty' and argument.id == 'priority': |
| 809 return False | 809 return False |
| 810 if argument.type.id == 'Dictionary': |
| 811 return False |
| 810 return True | 812 return True |
| 811 | 813 |
| 812 def _GenerateCPPIncludes(self, includes): | 814 def _GenerateCPPIncludes(self, includes): |
| 813 return ''.join(['#include %s\n' % include for include in sorted(includes)]) | 815 return ''.join(['#include %s\n' % include for include in sorted(includes)]) |
| 814 | 816 |
| 815 def _ToWebKitName(self, name): | 817 def _ToWebKitName(self, name): |
| 816 name = name[0].lower() + name[1:] | 818 name = name[0].lower() + name[1:] |
| 817 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), | 819 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), |
| 818 name) | 820 name) |
| 819 return re.sub(r'^(create|exclusive)', | 821 return re.sub(r'^(create|exclusive)', |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 def EmitResolver(self, template, output_dir): | 860 def EmitResolver(self, template, output_dir): |
| 859 file_path = os.path.join(output_dir, 'DartResolver.cpp') | 861 file_path = os.path.join(output_dir, 'DartResolver.cpp') |
| 860 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(
template) | 862 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit(
template) |
| 861 for header_file in self._headers_list: | 863 for header_file in self._headers_list: |
| 862 path = os.path.relpath(header_file, output_dir) | 864 path = os.path.relpath(header_file, output_dir) |
| 863 includes_emitter.Emit('#include "$PATH"\n', PATH=path) | 865 includes_emitter.Emit('#include "$PATH"\n', PATH=path) |
| 864 body_emitter.Emit( | 866 body_emitter.Emit( |
| 865 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume
ntCount))\n' | 867 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume
ntCount))\n' |
| 866 ' return func;\n', | 868 ' return func;\n', |
| 867 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 869 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| OLD | NEW |