| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 assert value is None | 301 assert value is None |
| 302 func_value = None | 302 func_value = None |
| 303 ctor_args = self._find_first(ext_attr, 'ExtAttrArgList') | 303 ctor_args = self._find_first(ext_attr, 'ExtAttrArgList') |
| 304 if ctor_args: | 304 if ctor_args: |
| 305 func_value = IDLExtAttrFunctionValue(None, ctor_args) | 305 func_value = IDLExtAttrFunctionValue(None, ctor_args) |
| 306 self.setdefault('Constructor', []).append(func_value) | 306 self.setdefault('Constructor', []).append(func_value) |
| 307 continue | 307 continue |
| 308 | 308 |
| 309 func_value = self._find_first(value, 'ExtAttrFunctionValue') | 309 func_value = self._find_first(value, 'ExtAttrFunctionValue') |
| 310 if func_value: | 310 if func_value: |
| 311 # E.g. NamedConstructor=Audio(in [Optional] DOMString src) | 311 # E.g. NamedConstructor=Audio(optional DOMString src) |
| 312 self[name] = IDLExtAttrFunctionValue( | 312 self[name] = IDLExtAttrFunctionValue( |
| 313 func_value, | 313 func_value, |
| 314 self._find_first(func_value, 'ExtAttrArgList')) | 314 self._find_first(func_value, 'ExtAttrArgList')) |
| 315 continue | 315 continue |
| 316 | 316 |
| 317 self[name] = value | 317 self[name] = value |
| 318 | 318 |
| 319 def _all_subnodes(self): | 319 def _all_subnodes(self): |
| 320 # Extended attributes may contain IDLNodes, e.g. IDLExtAttrFunctionValue | 320 # Extended attributes may contain IDLNodes, e.g. IDLExtAttrFunctionValue |
| 321 return self.values() | 321 return self.values() |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 def __init__(self, ast, doc_js_interface_name): | 490 def __init__(self, ast, doc_js_interface_name): |
| 491 IDLMember.__init__(self, ast, doc_js_interface_name) | 491 IDLMember.__init__(self, ast, doc_js_interface_name) |
| 492 self.value = self._find_first(ast, 'ConstExpr') | 492 self.value = self._find_first(ast, 'ConstExpr') |
| 493 | 493 |
| 494 | 494 |
| 495 class IDLArgument(IDLNode): | 495 class IDLArgument(IDLNode): |
| 496 """IDLNode specialization for operation arguments.""" | 496 """IDLNode specialization for operation arguments.""" |
| 497 def __init__(self, ast): | 497 def __init__(self, ast): |
| 498 IDLNode.__init__(self, ast) | 498 IDLNode.__init__(self, ast) |
| 499 self.type = self._convert_first(ast, 'Type', IDLType) | 499 self.type = self._convert_first(ast, 'Type', IDLType) |
| 500 self.optional = self._has(ast, 'Optional') |
| 500 self._convert_ext_attrs(ast) | 501 self._convert_ext_attrs(ast) |
| 501 | 502 |
| 502 def __repr__(self): | 503 def __repr__(self): |
| 503 return '<IDLArgument(type = %s, id = %s)>' % (self.type, self.id) | 504 return '<IDLArgument(type = %s, id = %s)>' % (self.type, self.id) |
| 504 | 505 |
| 505 | 506 |
| 506 class IDLImplementsStatement(IDLNode): | 507 class IDLImplementsStatement(IDLNode): |
| 507 """IDLNode specialization for 'X implements Y' declarations.""" | 508 """IDLNode specialization for 'X implements Y' declarations.""" |
| 508 def __init__(self, ast): | 509 def __init__(self, ast): |
| 509 IDLNode.__init__(self, ast) | 510 IDLNode.__init__(self, ast) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 530 """IDLDictNode specialization for one annotation.""" | 531 """IDLDictNode specialization for one annotation.""" |
| 531 def __init__(self, ast=None): | 532 def __init__(self, ast=None): |
| 532 IDLDictNode.__init__(self, ast) | 533 IDLDictNode.__init__(self, ast) |
| 533 self.id = None | 534 self.id = None |
| 534 if not ast: | 535 if not ast: |
| 535 return | 536 return |
| 536 for arg in self._find_all(ast, 'AnnotationArg'): | 537 for arg in self._find_all(ast, 'AnnotationArg'): |
| 537 name = self._find_first(arg, 'Id') | 538 name = self._find_first(arg, 'Id') |
| 538 value = self._find_first(arg, 'AnnotationArgValue') | 539 value = self._find_first(arg, 'AnnotationArgValue') |
| 539 self[name] = value | 540 self[name] = value |
| OLD | NEW |