Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: lib/dom/scripts/systemnative.py

Issue 10697080: Split backend.AddMembers call into series of backend.AddAtribute/backend.AddOperation calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« lib/dom/scripts/systemhtml.py ('K') | « lib/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 StartGeneratingMergedMembers(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 # Mute all the emitters.
201 self._original_emitters = {}
202 for key, value in self.__dict__.iteritems():
203 if isinstance(value, emitter.Emitter):
204 self._original_emitters[key] = value
205 self.__dict__[key] = emitter.Emitter()
206
207 def FinishGeneratingMergedMembers(self):
208 # Unmute all the emitters.
209 for key, value in self._original_emitters.iteritems():
210 self.__dict__[key] = value
211 del self._original_emitters
201 212
202 def StartInterface(self): 213 def StartInterface(self):
203 # Create emitters for c++ implementation. 214 # Create emitters for c++ implementation.
204 if self.HasImplementation(): 215 if self.HasImplementation():
205 cpp_header_path = self._system._FilePathForCppHeader(self._interface.id) 216 cpp_header_path = self._system._FilePathForCppHeader(self._interface.id)
206 self._system._cpp_header_files.append(cpp_header_path) 217 self._system._cpp_header_files.append(cpp_header_path)
207 self._cpp_header_emitter = self._system._emitters.FileEmitter(cpp_header_p ath) 218 self._cpp_header_emitter = self._system._emitters.FileEmitter(cpp_header_p ath)
208 cpp_impl_path = self._system._FilePathForCppImplementation(self._interface .id) 219 cpp_impl_path = self._system._FilePathForCppImplementation(self._interface .id)
209 self._system._cpp_impl_files.append(cpp_impl_path) 220 self._system._cpp_impl_files.append(cpp_impl_path)
210 self._cpp_impl_emitter = self._system._emitters.FileEmitter(cpp_impl_path) 221 self._cpp_impl_emitter = self._system._emitters.FileEmitter(cpp_impl_path)
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 ' goto fail;\n' 473 ' goto fail;\n'
463 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n' 474 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create ScriptCallStack());\n'
464 ' if (!scriptCallStack->size())\n' 475 ' if (!scriptCallStack->size())\n'
465 ' return;\n', 476 ' return;\n',
466 INDEX=len(node.arguments)) 477 INDEX=len(node.arguments))
467 arguments.extend(['scriptArguments', 'scriptCallStack']) 478 arguments.extend(['scriptArguments', 'scriptCallStack'])
468 return True 479 return True
469 480
470 return False 481 return False
471 482
472 def AddConstant(self, constant):
473 # Constants are already defined on the interface.
474 pass
475
476 def AddAttribute(self, attribute): 483 def AddAttribute(self, attribute):
477 getter = attribute 484 getter = attribute
478 setter = attribute if not systembase.IsReadOnly(attribute) else None 485 setter = attribute if not systembase.IsReadOnly(attribute) else None
479 if 'CheckSecurityForNode' in (getter or setter).ext_attrs: 486 if 'CheckSecurityForNode' in (getter or setter).ext_attrs:
480 # FIXME: exclude from interface as well. 487 # FIXME: exclude from interface as well.
481 return 488 return
482 489
483 dom_name = DartDomNameOfAttribute(getter or setter) 490 dom_name = DartDomNameOfAttribute(getter or setter)
484 html_getter_name = self._html_system.RenameInHtmlLibrary( 491 html_getter_name = self._html_system.RenameInHtmlLibrary(
485 self._interface.id, dom_name, 'get:', implementation_class=True) 492 self._interface.id, dom_name, 'get:', implementation_class=True)
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 992
986 def _IsArgumentOptionalInWebCore(argument): 993 def _IsArgumentOptionalInWebCore(argument):
987 return IsOptional(argument) and not 'Callback' in argument.ext_attrs 994 return IsOptional(argument) and not 'Callback' in argument.ext_attrs
988 995
989 def _ToWebKitName(name): 996 def _ToWebKitName(name):
990 name = name[0].lower() + name[1:] 997 name = name[0].lower() + name[1:]
991 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), 998 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(),
992 name) 999 name)
993 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() , 1000 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() ,
994 name) 1001 name)
OLDNEW
« lib/dom/scripts/systemhtml.py ('K') | « lib/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698