OLD | NEW |
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 Loading... |
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 self.is_optional = 'Optional' in self.ext_attrs | |
463 | 462 |
464 def __repr__(self): | 463 def __repr__(self): |
465 return '<IDLArgument(type = %s, id = %s)>' % (self.type, self.id) | 464 return '<IDLArgument(type = %s, id = %s)>' % (self.type, self.id) |
466 | 465 |
467 | 466 |
468 class IDLImplementsStatement(IDLNode): | 467 class IDLImplementsStatement(IDLNode): |
469 """IDLNode specialization for 'X implements Y' declarations.""" | 468 """IDLNode specialization for 'X implements Y' declarations.""" |
470 def __init__(self, ast): | 469 def __init__(self, ast): |
471 IDLNode.__init__(self, ast) | 470 IDLNode.__init__(self, ast) |
472 self.implementor = self._convert_first(ast, 'ImplStmtImplementor', | 471 self.implementor = self._convert_first(ast, 'ImplStmtImplementor', |
(...skipping 19 matching lines...) Expand all Loading... |
492 """IDLDictNode specialization for one annotation.""" | 491 """IDLDictNode specialization for one annotation.""" |
493 def __init__(self, ast=None): | 492 def __init__(self, ast=None): |
494 IDLDictNode.__init__(self, ast) | 493 IDLDictNode.__init__(self, ast) |
495 self.id = None | 494 self.id = None |
496 if not ast: | 495 if not ast: |
497 return | 496 return |
498 for arg in self._find_all(ast, 'AnnotationArg'): | 497 for arg in self._find_all(ast, 'AnnotationArg'): |
499 name = self._find_first(arg, 'Id') | 498 name = self._find_first(arg, 'Id') |
500 value = self._find_first(arg, 'AnnotationArgValue') | 499 value = self._find_first(arg, 'AnnotationArgValue') |
501 self[name] = value | 500 self[name] = value |
OLD | NEW |