| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 file_name = '%sFactoryProviderImplementation.dart' % self._interface.id | 186 file_name = '%sFactoryProviderImplementation.dart' % self._interface.id |
| 187 return os.path.join(self._system._output_dir, 'dart', file_name) | 187 return os.path.join(self._system._output_dir, 'dart', file_name) |
| 188 | 188 |
| 189 def FilePathForDartElementsFactoryProviderImplementation(self): | 189 def FilePathForDartElementsFactoryProviderImplementation(self): |
| 190 return os.path.join(self._system._output_dir, 'dart', | 190 return os.path.join(self._system._output_dir, 'dart', |
| 191 '_ElementsFactoryProviderImplementation.dart') | 191 '_ElementsFactoryProviderImplementation.dart') |
| 192 | 192 |
| 193 def SetImplementationEmitter(self, implementation_emitter): | 193 def SetImplementationEmitter(self, implementation_emitter): |
| 194 self._dart_impl_emitter = implementation_emitter | 194 self._dart_impl_emitter = implementation_emitter |
| 195 | 195 |
| 196 def AddMergedMembers(self, merged_interface): | 196 def ImplementsMergedMembers(self): |
| 197 # We could not add merged functions to implementation class because | 197 # We could not add merged functions to implementation class because |
| 198 # underlying c++ object doesn't implement them. Merged functions are | 198 # underlying c++ object doesn't implement them. Merged functions are |
| 199 # generated on merged interface implementation instead. | 199 # generated on merged interface implementation instead. |
| 200 pass | 200 return False |
| 201 | 201 |
| 202 def StartInterface(self): | 202 def StartInterface(self): |
| 203 # Create emitters for c++ implementation. | 203 # Create emitters for c++ implementation. |
| 204 if self.HasImplementation(): | 204 if self.HasImplementation(): |
| 205 cpp_header_path = self._system._FilePathForCppHeader(self._interface.id) | 205 cpp_header_path = self._system._FilePathForCppHeader(self._interface.id) |
| 206 self._system._cpp_header_files.append(cpp_header_path) | 206 self._system._cpp_header_files.append(cpp_header_path) |
| 207 self._cpp_header_emitter = self._system._emitters.FileEmitter(cpp_header_p
ath) | 207 self._cpp_header_emitter = self._system._emitters.FileEmitter(cpp_header_p
ath) |
| 208 cpp_impl_path = self._system._FilePathForCppImplementation(self._interface
.id) | 208 cpp_impl_path = self._system._FilePathForCppImplementation(self._interface
.id) |
| 209 self._system._cpp_impl_files.append(cpp_impl_path) | 209 self._system._cpp_impl_files.append(cpp_impl_path) |
| 210 self._cpp_impl_emitter = self._system._emitters.FileEmitter(cpp_impl_path) | 210 self._cpp_impl_emitter = self._system._emitters.FileEmitter(cpp_impl_path) |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 ' goto fail;\n' | 462 ' goto fail;\n' |
| 463 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create
ScriptCallStack());\n' | 463 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create
ScriptCallStack());\n' |
| 464 ' if (!scriptCallStack->size())\n' | 464 ' if (!scriptCallStack->size())\n' |
| 465 ' return;\n', | 465 ' return;\n', |
| 466 INDEX=len(node.arguments)) | 466 INDEX=len(node.arguments)) |
| 467 arguments.extend(['scriptArguments', 'scriptCallStack']) | 467 arguments.extend(['scriptArguments', 'scriptCallStack']) |
| 468 return True | 468 return True |
| 469 | 469 |
| 470 return False | 470 return False |
| 471 | 471 |
| 472 def AddConstant(self, constant): | |
| 473 # Constants are already defined on the interface. | |
| 474 pass | |
| 475 | |
| 476 def AddAttribute(self, attribute): | 472 def AddAttribute(self, attribute): |
| 477 getter = attribute | 473 getter = attribute |
| 478 setter = attribute if not systembase.IsReadOnly(attribute) else None | 474 setter = attribute if not systembase.IsReadOnly(attribute) else None |
| 479 if 'CheckSecurityForNode' in (getter or setter).ext_attrs: | 475 if 'CheckSecurityForNode' in (getter or setter).ext_attrs: |
| 480 # FIXME: exclude from interface as well. | 476 # FIXME: exclude from interface as well. |
| 481 return | 477 return |
| 482 | 478 |
| 483 dom_name = DartDomNameOfAttribute(getter or setter) | 479 dom_name = DartDomNameOfAttribute(getter or setter) |
| 484 html_getter_name = self._html_system.RenameInHtmlLibrary( | 480 html_getter_name = self._html_system.RenameInHtmlLibrary( |
| 485 self._interface.id, dom_name, 'get:', implementation_class=True) | 481 self._interface.id, dom_name, 'get:', implementation_class=True) |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 | 981 |
| 986 def _IsArgumentOptionalInWebCore(argument): | 982 def _IsArgumentOptionalInWebCore(argument): |
| 987 return IsOptional(argument) and not 'Callback' in argument.ext_attrs | 983 return IsOptional(argument) and not 'Callback' in argument.ext_attrs |
| 988 | 984 |
| 989 def _ToWebKitName(name): | 985 def _ToWebKitName(name): |
| 990 name = name[0].lower() + name[1:] | 986 name = name[0].lower() + name[1:] |
| 991 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), | 987 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), |
| 992 name) | 988 name) |
| 993 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, | 989 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, |
| 994 name) | 990 name) |
| OLD | NEW |