| 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 MergedMembersGenerator(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 dummy generator. |
| 201 return systembase.BaseGenerator(self._database, self._interface) |
| 201 | 202 |
| 202 def StartInterface(self): | 203 def StartInterface(self): |
| 203 # Create emitters for c++ implementation. | 204 # Create emitters for c++ implementation. |
| 204 if self.HasImplementation(): | 205 if self.HasImplementation(): |
| 205 cpp_header_path = self._system._FilePathForCppHeader(self._interface.id) | 206 cpp_header_path = self._system._FilePathForCppHeader(self._interface.id) |
| 206 self._system._cpp_header_files.append(cpp_header_path) | 207 self._system._cpp_header_files.append(cpp_header_path) |
| 207 self._cpp_header_emitter = self._system._emitters.FileEmitter(cpp_header_p
ath) | 208 self._cpp_header_emitter = self._system._emitters.FileEmitter(cpp_header_p
ath) |
| 208 cpp_impl_path = self._system._FilePathForCppImplementation(self._interface
.id) | 209 cpp_impl_path = self._system._FilePathForCppImplementation(self._interface
.id) |
| 209 self._system._cpp_impl_files.append(cpp_impl_path) | 210 self._system._cpp_impl_files.append(cpp_impl_path) |
| 210 self._cpp_impl_emitter = self._system._emitters.FileEmitter(cpp_impl_path) | 211 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' | 463 ' goto fail;\n' |
| 463 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create
ScriptCallStack());\n' | 464 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create
ScriptCallStack());\n' |
| 464 ' if (!scriptCallStack->size())\n' | 465 ' if (!scriptCallStack->size())\n' |
| 465 ' return;\n', | 466 ' return;\n', |
| 466 INDEX=len(node.arguments)) | 467 INDEX=len(node.arguments)) |
| 467 arguments.extend(['scriptArguments', 'scriptCallStack']) | 468 arguments.extend(['scriptArguments', 'scriptCallStack']) |
| 468 return True | 469 return True |
| 469 | 470 |
| 470 return False | 471 return False |
| 471 | 472 |
| 472 def AddConstant(self, constant): | |
| 473 # Constants are already defined on the interface. | |
| 474 pass | |
| 475 | |
| 476 def AddAttribute(self, attribute): | 473 def AddAttribute(self, attribute): |
| 477 getter = attribute | 474 getter = attribute |
| 478 setter = attribute if not systembase.IsReadOnly(attribute) else None | 475 setter = attribute if not systembase.IsReadOnly(attribute) else None |
| 479 if 'CheckSecurityForNode' in (getter or setter).ext_attrs: | 476 if 'CheckSecurityForNode' in (getter or setter).ext_attrs: |
| 480 # FIXME: exclude from interface as well. | 477 # FIXME: exclude from interface as well. |
| 481 return | 478 return |
| 482 | 479 |
| 483 dom_name = DartDomNameOfAttribute(getter or setter) | 480 dom_name = DartDomNameOfAttribute(getter or setter) |
| 484 html_getter_name = self._html_system.RenameInHtmlLibrary( | 481 html_getter_name = self._html_system.RenameInHtmlLibrary( |
| 485 self._interface.id, dom_name, 'get:', implementation_class=True) | 482 self._interface.id, dom_name, 'get:', implementation_class=True) |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 | 982 |
| 986 def _IsArgumentOptionalInWebCore(argument): | 983 def _IsArgumentOptionalInWebCore(argument): |
| 987 return IsOptional(argument) and not 'Callback' in argument.ext_attrs | 984 return IsOptional(argument) and not 'Callback' in argument.ext_attrs |
| 988 | 985 |
| 989 def _ToWebKitName(name): | 986 def _ToWebKitName(name): |
| 990 name = name[0].lower() + name[1:] | 987 name = name[0].lower() + name[1:] |
| 991 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), | 988 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), |
| 992 name) | 989 name) |
| 993 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, | 990 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize()
, |
| 994 name) | 991 name) |
| OLD | NEW |