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

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

Issue 10521002: Use WebKit IDL syntax for declaring optional parameters in dart.idl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « lib/dom/scripts/databasebuilder.py ('k') | lib/dom/scripts/idlrenderer.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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 IDLMember.__init__(self, ast, doc_js_interface_name) 452 IDLMember.__init__(self, ast, doc_js_interface_name)
453 self.value = self._find_first(ast, 'ConstExpr') 453 self.value = self._find_first(ast, 'ConstExpr')
454 454
455 455
456 class IDLArgument(IDLNode): 456 class IDLArgument(IDLNode):
457 """IDLNode specialization for operation arguments.""" 457 """IDLNode specialization for operation arguments."""
458 def __init__(self, ast): 458 def __init__(self, ast):
459 IDLNode.__init__(self, ast) 459 IDLNode.__init__(self, ast)
460 self.type = self._convert_first(ast, 'Type', IDLType) 460 self.type = self._convert_first(ast, 'Type', IDLType)
461 self._convert_ext_attrs(ast) 461 self._convert_ext_attrs(ast)
462 # WebKit and Web IDL differ in how Optional is declared: 462 self.is_optional = 'Optional' in self.ext_attrs
463 self.is_optional = self._has(ast, 'Optional') \
464 or ('Optional' in self.ext_attrs)
465 463
466 def __repr__(self): 464 def __repr__(self):
467 return '<IDLArgument(type = %s, id = %s)>' % (self.type, self.id) 465 return '<IDLArgument(type = %s, id = %s)>' % (self.type, self.id)
468 466
469 467
470 class IDLImplementsStatement(IDLNode): 468 class IDLImplementsStatement(IDLNode):
471 """IDLNode specialization for 'X implements Y' declarations.""" 469 """IDLNode specialization for 'X implements Y' declarations."""
472 def __init__(self, ast): 470 def __init__(self, ast):
473 IDLNode.__init__(self, ast) 471 IDLNode.__init__(self, ast)
474 self.implementor = self._convert_first(ast, 'ImplStmtImplementor', 472 self.implementor = self._convert_first(ast, 'ImplStmtImplementor',
(...skipping 19 matching lines...) Expand all
494 """IDLDictNode specialization for one annotation.""" 492 """IDLDictNode specialization for one annotation."""
495 def __init__(self, ast=None): 493 def __init__(self, ast=None):
496 IDLDictNode.__init__(self, ast) 494 IDLDictNode.__init__(self, ast)
497 self.id = None 495 self.id = None
498 if not ast: 496 if not ast:
499 return 497 return
500 for arg in self._find_all(ast, 'AnnotationArg'): 498 for arg in self._find_all(ast, 'AnnotationArg'):
501 name = self._find_first(arg, 'Id') 499 name = self._find_first(arg, 'Id')
502 value = self._find_first(arg, 'AnnotationArgValue') 500 value = self._find_first(arg, 'AnnotationArgValue')
503 self[name] = value 501 self[name] = value
OLDNEW
« no previous file with comments | « lib/dom/scripts/databasebuilder.py ('k') | lib/dom/scripts/idlrenderer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698