| 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 sys | 7 import sys |
| 7 | 8 |
| 8 | 9 |
| 9 class IDLNode(object): | 10 class IDLNode(object): |
| 10 """Base class for all IDL elements. | 11 """Base class for all IDL elements. |
| 11 IDLNode may contain various child nodes, and have properties. Examples | 12 IDLNode may contain various child nodes, and have properties. Examples |
| 12 of IDLNode are interfaces, interface members, function arguments, | 13 of IDLNode are interfaces, interface members, function arguments, |
| 13 etc. | 14 etc. |
| 14 """ | 15 """ |
| 15 | 16 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 380 |
| 380 def __init__(self, ast): | 381 def __init__(self, ast): |
| 381 IDLNode.__init__(self, ast) | 382 IDLNode.__init__(self, ast) |
| 382 self._convert_ext_attrs(ast) | 383 self._convert_ext_attrs(ast) |
| 383 self._convert_annotations(ast) | 384 self._convert_annotations(ast) |
| 384 self.parents = self._convert_all(ast, 'ParentInterface', | 385 self.parents = self._convert_all(ast, 'ParentInterface', |
| 385 IDLParentInterface) | 386 IDLParentInterface) |
| 386 javascript_interface_name = self.ext_attrs.get('InterfaceName', self.id) | 387 javascript_interface_name = self.ext_attrs.get('InterfaceName', self.id) |
| 387 self.javascript_binding_name = javascript_interface_name | 388 self.javascript_binding_name = javascript_interface_name |
| 388 self.doc_js_name = javascript_interface_name | 389 self.doc_js_name = javascript_interface_name |
| 389 self.operations = self._convert_all(ast, 'Operation', | 390 self.operations = self._convert_all(ast, 'Operation', |
| 390 lambda ast: IDLOperation(ast, self.doc_js_name)) | 391 lambda ast: IDLOperation(ast, self.doc_js_name)) |
| 391 self.attributes = self._convert_all(ast, 'Attribute', | 392 self.attributes = self._convert_all(ast, 'Attribute', |
| 392 lambda ast: IDLAttribute(ast, self.doc_js_name)) | 393 lambda ast: IDLAttribute(ast, self.doc_js_name)) |
| 393 self.constants = self._convert_all(ast, 'Const', | 394 self.constants = self._convert_all(ast, 'Const', |
| 394 lambda ast: IDLConstant(ast, self.doc_js_name)) | 395 lambda ast: IDLConstant(ast, self.doc_js_name)) |
| 395 self.is_supplemental = 'Supplemental' in self.ext_attrs | 396 self.is_supplemental = 'Supplemental' in self.ext_attrs |
| 396 self.is_no_interface_object = 'NoInterfaceObject' in self.ext_attrs | 397 self.is_no_interface_object = 'NoInterfaceObject' in self.ext_attrs |
| 397 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs | 398 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs |
| 398 | 399 |
| 399 def reset_id(self, new_id): | 400 def reset_id(self, new_id): |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 """IDLDictNode specialization for one annotation.""" | 515 """IDLDictNode specialization for one annotation.""" |
| 515 def __init__(self, ast=None): | 516 def __init__(self, ast=None): |
| 516 IDLDictNode.__init__(self, ast) | 517 IDLDictNode.__init__(self, ast) |
| 517 self.id = None | 518 self.id = None |
| 518 if not ast: | 519 if not ast: |
| 519 return | 520 return |
| 520 for arg in self._find_all(ast, 'AnnotationArg'): | 521 for arg in self._find_all(ast, 'AnnotationArg'): |
| 521 name = self._find_first(arg, 'Id') | 522 name = self._find_first(arg, 'Id') |
| 522 value = self._find_first(arg, 'AnnotationArgValue') | 523 value = self._find_first(arg, 'AnnotationArgValue') |
| 523 self[name] = value | 524 self[name] = value |
| OLD | NEW |