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

Side by Side Diff: client/dom/scripts/idlnode.py

Issue 9403004: Wrapperless dart:html generator (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final version to check in. changes generator script but doesn't check in an active version of the … Created 8 years, 10 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
« no previous file with comments | « client/dom/scripts/generator.py ('k') | client/dom/scripts/idlnode_test.py » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, 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 import sys 6 import sys
7 7
8 8
9 class IDLNode(object): 9 class IDLNode(object):
10 """Base class for all IDL elements. 10 """Base class for all IDL elements.
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 self._convert_ext_attrs(ast) 344 self._convert_ext_attrs(ast)
345 self._convert_annotations(ast) 345 self._convert_annotations(ast)
346 self.parents = self._convert_all(ast, 'ParentInterface', 346 self.parents = self._convert_all(ast, 'ParentInterface',
347 IDLParentInterface) 347 IDLParentInterface)
348 self.operations = self._convert_all(ast, 'Operation', IDLOperation) 348 self.operations = self._convert_all(ast, 'Operation', IDLOperation)
349 self.attributes = self._convert_all(ast, 'Attribute', IDLAttribute) 349 self.attributes = self._convert_all(ast, 'Attribute', IDLAttribute)
350 self.constants = self._convert_all(ast, 'Const', IDLConstant) 350 self.constants = self._convert_all(ast, 'Const', IDLConstant)
351 self.is_supplemental = 'Supplemental' in self.ext_attrs 351 self.is_supplemental = 'Supplemental' in self.ext_attrs
352 self.is_no_interface_object = 'NoInterfaceObject' in self.ext_attrs 352 self.is_no_interface_object = 'NoInterfaceObject' in self.ext_attrs
353 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs 353 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs
354 self.javascript_binding_name = self.id
354 355
356 def has_attribute(self, candidate):
357 for attribute in self.attributes:
358 if attribute.id == candidate.id and attribute.is_fc_getter == candidate.is _fc_getter and attribute.is_fc_setter == candidate.is_fc_setter:
359 return True
360 return False
361
362 def merge(self, other):
363 self.operations.extend(other.operations)
364 for attribute in other.attributes:
365 if not self.has_attribute(attribute):
366 self.attributes.append(attribute)
367
368 self.constants.extend(other.constants)
355 369
356 class IDLParentInterface(IDLNode): 370 class IDLParentInterface(IDLNode):
357 """This IDLNode specialization is for 'Interface Child : Parent {}' 371 """This IDLNode specialization is for 'Interface Child : Parent {}'
358 declarations.""" 372 declarations."""
359 def __init__(self, ast): 373 def __init__(self, ast):
360 IDLNode.__init__(self, ast) 374 IDLNode.__init__(self, ast)
361 self._convert_annotations(ast) 375 self._convert_annotations(ast)
362 self.type = self._convert_first(ast, 'InterfaceType', IDLType) 376 self.type = self._convert_first(ast, 'InterfaceType', IDLType)
363 377
364 378
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 """IDLDictNode specialization for one annotation.""" 468 """IDLDictNode specialization for one annotation."""
455 def __init__(self, ast=None): 469 def __init__(self, ast=None):
456 IDLDictNode.__init__(self, ast) 470 IDLDictNode.__init__(self, ast)
457 self.id = None 471 self.id = None
458 if not ast: 472 if not ast:
459 return 473 return
460 for arg in self._find_all(ast, 'AnnotationArg'): 474 for arg in self._find_all(ast, 'AnnotationArg'):
461 name = self._find_first(arg, 'Id') 475 name = self._find_first(arg, 'Id')
462 value = self._find_first(arg, 'AnnotationArgValue') 476 value = self._find_first(arg, 'AnnotationArgValue')
463 self[name] = value 477 self[name] = value
OLDNEW
« no previous file with comments | « client/dom/scripts/generator.py ('k') | client/dom/scripts/idlnode_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698