| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 def __init__(self, ast, doc_js_interface_name): | 475 def __init__(self, ast, doc_js_interface_name): |
| 476 IDLMember.__init__(self, ast, doc_js_interface_name) | 476 IDLMember.__init__(self, ast, doc_js_interface_name) |
| 477 self.type = self._convert_first(ast, 'ReturnType', IDLType) | 477 self.type = self._convert_first(ast, 'ReturnType', IDLType) |
| 478 self.arguments = self._convert_all(ast, 'Argument', IDLArgument) | 478 self.arguments = self._convert_all(ast, 'Argument', IDLArgument) |
| 479 self.specials = self._find_all(ast, 'Special') | 479 self.specials = self._find_all(ast, 'Special') |
| 480 self.is_stringifier = self._has(ast, 'Stringifier') | 480 self.is_stringifier = self._has(ast, 'Stringifier') |
| 481 # Special case: there are getters of the form | 481 # Special case: there are getters of the form |
| 482 # getter <ReturnType>(args). For now force the name to be __getter__, | 482 # getter <ReturnType>(args). For now force the name to be __getter__, |
| 483 # but it should be operator[] later. | 483 # but it should be operator[] later. |
| 484 if self.id is None: | 484 if self.id is None: |
| 485 if len(self.specials) != 1: | 485 if self.specials == ['getter']: |
| 486 self.id = '__getter__' |
| 487 elif self.specials == ['setter']: |
| 488 self.id = '__setter__' |
| 489 # Special case: if it's a setter, ignore 'declared' return type |
| 490 self.type = IDLType([('VoidType', None)]) |
| 491 elif self.specials == ['deleter']: |
| 492 self.id = '__delete__' |
| 493 else: |
| 486 raise Exception('Cannot handle %s: operation has no id' % ast) | 494 raise Exception('Cannot handle %s: operation has no id' % ast) |
| 487 self.id = '__%s__' % self.specials[0] | 495 |
| 488 def _extra_repr(self): | 496 def _extra_repr(self): |
| 489 return [self.arguments] | 497 return [self.arguments] |
| 490 | 498 |
| 491 | 499 |
| 492 class IDLAttribute(IDLMember): | 500 class IDLAttribute(IDLMember): |
| 493 """IDLNode specialization for 'attribute type name' declarations.""" | 501 """IDLNode specialization for 'attribute type name' declarations.""" |
| 494 def __init__(self, ast, doc_js_interface_name): | 502 def __init__(self, ast, doc_js_interface_name): |
| 495 IDLMember.__init__(self, ast, doc_js_interface_name) | 503 IDLMember.__init__(self, ast, doc_js_interface_name) |
| 496 self.is_read_only = self._has(ast, 'ReadOnly') | 504 self.is_read_only = self._has(ast, 'ReadOnly') |
| 497 # There are various ways to define exceptions for attributes: | 505 # There are various ways to define exceptions for attributes: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 """IDLDictNode specialization for one annotation.""" | 557 """IDLDictNode specialization for one annotation.""" |
| 550 def __init__(self, ast=None): | 558 def __init__(self, ast=None): |
| 551 IDLDictNode.__init__(self, ast) | 559 IDLDictNode.__init__(self, ast) |
| 552 self.id = None | 560 self.id = None |
| 553 if not ast: | 561 if not ast: |
| 554 return | 562 return |
| 555 for arg in self._find_all(ast, 'AnnotationArg'): | 563 for arg in self._find_all(ast, 'AnnotationArg'): |
| 556 name = self._find_first(arg, 'Id') | 564 name = self._find_first(arg, 'Id') |
| 557 value = self._find_first(arg, 'AnnotationArgValue') | 565 value = self._find_first(arg, 'AnnotationArgValue') |
| 558 self[name] = value | 566 self[name] = value |
| OLD | NEW |