| 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 os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 | 9 |
| 10 class IDLNode(object): | 10 class IDLNode(object): |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs | 461 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs |
| 462 self.is_static = self._has(ast, 'Static') | 462 self.is_static = self._has(ast, 'Static') |
| 463 | 463 |
| 464 | 464 |
| 465 class IDLOperation(IDLMember): | 465 class IDLOperation(IDLMember): |
| 466 """IDLNode specialization for 'type name(args)' declarations.""" | 466 """IDLNode specialization for 'type name(args)' declarations.""" |
| 467 def __init__(self, ast, doc_js_interface_name): | 467 def __init__(self, ast, doc_js_interface_name): |
| 468 IDLMember.__init__(self, ast, doc_js_interface_name) | 468 IDLMember.__init__(self, ast, doc_js_interface_name) |
| 469 self.type = self._convert_first(ast, 'ReturnType', IDLType) | 469 self.type = self._convert_first(ast, 'ReturnType', IDLType) |
| 470 self.arguments = self._convert_all(ast, 'Argument', IDLArgument) | 470 self.arguments = self._convert_all(ast, 'Argument', IDLArgument) |
| 471 self.raises = self._convert_first(ast, 'Raises', IDLType) | |
| 472 self.specials = self._find_all(ast, 'Special') | 471 self.specials = self._find_all(ast, 'Special') |
| 473 self.is_stringifier = self._has(ast, 'Stringifier') | 472 self.is_stringifier = self._has(ast, 'Stringifier') |
| 474 def _extra_repr(self): | 473 def _extra_repr(self): |
| 475 return [self.arguments] | 474 return [self.arguments] |
| 476 | 475 |
| 477 | 476 |
| 478 class IDLAttribute(IDLMember): | 477 class IDLAttribute(IDLMember): |
| 479 """IDLNode specialization for 'attribute type name' declarations.""" | 478 """IDLNode specialization for 'attribute type name' declarations.""" |
| 480 def __init__(self, ast, doc_js_interface_name): | 479 def __init__(self, ast, doc_js_interface_name): |
| 481 IDLMember.__init__(self, ast, doc_js_interface_name) | 480 IDLMember.__init__(self, ast, doc_js_interface_name) |
| 482 self.is_read_only = self._has(ast, 'ReadOnly') | 481 self.is_read_only = self._has(ast, 'ReadOnly') |
| 483 # There are various ways to define exceptions for attributes: | 482 # There are various ways to define exceptions for attributes: |
| 484 self.raises = self._convert_first(ast, 'Raises', IDLType) | |
| 485 self.get_raises = self.raises \ | |
| 486 or self._convert_first(ast, 'GetRaises', IDLType) | |
| 487 self.set_raises = self.raises \ | |
| 488 or self._convert_first(ast, 'SetRaises', IDLType) | |
| 489 def _extra_repr(self): | 483 def _extra_repr(self): |
| 490 extra = [] | 484 extra = [] |
| 491 if self.is_read_only: extra.append('readonly') | 485 if self.is_read_only: extra.append('readonly') |
| 492 if self.raises: extra.append('raises') | |
| 493 return extra | 486 return extra |
| 494 | 487 |
| 495 class IDLConstant(IDLMember): | 488 class IDLConstant(IDLMember): |
| 496 """IDLNode specialization for 'const type name = value' declarations.""" | 489 """IDLNode specialization for 'const type name = value' declarations.""" |
| 497 def __init__(self, ast, doc_js_interface_name): | 490 def __init__(self, ast, doc_js_interface_name): |
| 498 IDLMember.__init__(self, ast, doc_js_interface_name) | 491 IDLMember.__init__(self, ast, doc_js_interface_name) |
| 499 self.value = self._find_first(ast, 'ConstExpr') | 492 self.value = self._find_first(ast, 'ConstExpr') |
| 500 | 493 |
| 501 | 494 |
| 502 class IDLArgument(IDLNode): | 495 class IDLArgument(IDLNode): |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 """IDLDictNode specialization for one annotation.""" | 530 """IDLDictNode specialization for one annotation.""" |
| 538 def __init__(self, ast=None): | 531 def __init__(self, ast=None): |
| 539 IDLDictNode.__init__(self, ast) | 532 IDLDictNode.__init__(self, ast) |
| 540 self.id = None | 533 self.id = None |
| 541 if not ast: | 534 if not ast: |
| 542 return | 535 return |
| 543 for arg in self._find_all(ast, 'AnnotationArg'): | 536 for arg in self._find_all(ast, 'AnnotationArg'): |
| 544 name = self._find_first(arg, 'Id') | 537 name = self._find_first(arg, 'Id') |
| 545 value = self._find_first(arg, 'AnnotationArgValue') | 538 value = self._find_first(arg, 'AnnotationArgValue') |
| 546 self[name] = value | 539 self[name] = value |
| OLD | NEW |