| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 471 |
| 472 | 472 |
| 473 class IDLOperation(IDLMember): | 473 class IDLOperation(IDLMember): |
| 474 """IDLNode specialization for 'type name(args)' declarations.""" | 474 """IDLNode specialization for 'type name(args)' declarations.""" |
| 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 |
| 482 # getter <ReturnType>(args). For now force the name to be __getter__, |
| 483 # but it should be operator[] later. |
| 484 if self.id is None: |
| 485 if len(self.specials) != 1: |
| 486 raise Exception('Cannot handle %s: operation has no id' % ast) |
| 487 self.id = '__%s__' % self.specials[0] |
| 481 def _extra_repr(self): | 488 def _extra_repr(self): |
| 482 return [self.arguments] | 489 return [self.arguments] |
| 483 | 490 |
| 484 | 491 |
| 485 class IDLAttribute(IDLMember): | 492 class IDLAttribute(IDLMember): |
| 486 """IDLNode specialization for 'attribute type name' declarations.""" | 493 """IDLNode specialization for 'attribute type name' declarations.""" |
| 487 def __init__(self, ast, doc_js_interface_name): | 494 def __init__(self, ast, doc_js_interface_name): |
| 488 IDLMember.__init__(self, ast, doc_js_interface_name) | 495 IDLMember.__init__(self, ast, doc_js_interface_name) |
| 489 self.is_read_only = self._has(ast, 'ReadOnly') | 496 self.is_read_only = self._has(ast, 'ReadOnly') |
| 490 # There are various ways to define exceptions for attributes: | 497 # There are various ways to define exceptions for attributes: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 """IDLDictNode specialization for one annotation.""" | 549 """IDLDictNode specialization for one annotation.""" |
| 543 def __init__(self, ast=None): | 550 def __init__(self, ast=None): |
| 544 IDLDictNode.__init__(self, ast) | 551 IDLDictNode.__init__(self, ast) |
| 545 self.id = None | 552 self.id = None |
| 546 if not ast: | 553 if not ast: |
| 547 return | 554 return |
| 548 for arg in self._find_all(ast, 'AnnotationArg'): | 555 for arg in self._find_all(ast, 'AnnotationArg'): |
| 549 name = self._find_first(arg, 'Id') | 556 name = self._find_first(arg, 'Id') |
| 550 value = self._find_first(arg, 'AnnotationArgValue') | 557 value = self._find_first(arg, 'AnnotationArgValue') |
| 551 self[name] = value | 558 self[name] = value |
| OLD | NEW |