| 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 sys | 6 import sys |
| 7 | 7 |
| 8 | 8 |
| 9 class IDLNode(object): | 9 class IDLNode(object): |
| 10 """Base class for all IDL elements. | 10 """Base class for all IDL elements. |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 def __init__(self, ast): | 339 def __init__(self, ast): |
| 340 IDLNode.__init__(self, ast) | 340 IDLNode.__init__(self, ast) |
| 341 self._convert_ext_attrs(ast) | 341 self._convert_ext_attrs(ast) |
| 342 self._convert_annotations(ast) | 342 self._convert_annotations(ast) |
| 343 self.parents = self._convert_all(ast, 'ParentInterface', | 343 self.parents = self._convert_all(ast, 'ParentInterface', |
| 344 IDLParentInterface) | 344 IDLParentInterface) |
| 345 self.operations = self._convert_all(ast, 'Operation', IDLOperation) | 345 self.operations = self._convert_all(ast, 'Operation', IDLOperation) |
| 346 self.attributes = self._convert_all(ast, 'Attribute', IDLAttribute) | 346 self.attributes = self._convert_all(ast, 'Attribute', IDLAttribute) |
| 347 self.constants = self._convert_all(ast, 'Const', IDLConstant) | 347 self.constants = self._convert_all(ast, 'Const', IDLConstant) |
| 348 self.snippets = self._convert_all(ast, 'Snippet', IDLSnippet) | |
| 349 self.is_supplemental = 'Supplemental' in self.ext_attrs | 348 self.is_supplemental = 'Supplemental' in self.ext_attrs |
| 350 self.is_no_interface_object = 'NoInterfaceObject' in self.ext_attrs | 349 self.is_no_interface_object = 'NoInterfaceObject' in self.ext_attrs |
| 351 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs | 350 self.is_fc_suppressed = 'Suppressed' in self.ext_attrs |
| 352 | 351 |
| 353 | 352 |
| 354 class IDLParentInterface(IDLNode): | 353 class IDLParentInterface(IDLNode): |
| 355 """This IDLNode specialization is for 'Interface Child : Parent {}' | 354 """This IDLNode specialization is for 'Interface Child : Parent {}' |
| 356 declarations.""" | 355 declarations.""" |
| 357 def __init__(self, ast): | 356 def __init__(self, ast): |
| 358 IDLNode.__init__(self, ast) | 357 IDLNode.__init__(self, ast) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 if self.raises: extra.append('raises') | 406 if self.raises: extra.append('raises') |
| 408 return extra | 407 return extra |
| 409 | 408 |
| 410 class IDLConstant(IDLMember): | 409 class IDLConstant(IDLMember): |
| 411 """IDLNode specialization for 'const type name = value' declarations.""" | 410 """IDLNode specialization for 'const type name = value' declarations.""" |
| 412 def __init__(self, ast): | 411 def __init__(self, ast): |
| 413 IDLMember.__init__(self, ast) | 412 IDLMember.__init__(self, ast) |
| 414 self.value = self._find_first(ast, 'ConstExpr') | 413 self.value = self._find_first(ast, 'ConstExpr') |
| 415 | 414 |
| 416 | 415 |
| 417 class IDLSnippet(IDLMember): | |
| 418 """IDLNode specialization for 'snippet { data };""" | |
| 419 def __init__(self, ast): | |
| 420 IDLMember.__init__(self, ast) | |
| 421 self._convert_annotations(ast) | |
| 422 self.text = self._find_first(ast, 'SnippetText') | |
| 423 | |
| 424 | |
| 425 class IDLArgument(IDLNode): | 416 class IDLArgument(IDLNode): |
| 426 """IDLNode specialization for operation arguments.""" | 417 """IDLNode specialization for operation arguments.""" |
| 427 def __init__(self, ast): | 418 def __init__(self, ast): |
| 428 IDLNode.__init__(self, ast) | 419 IDLNode.__init__(self, ast) |
| 429 self.type = self._convert_first(ast, 'Type', IDLType) | 420 self.type = self._convert_first(ast, 'Type', IDLType) |
| 430 self._convert_ext_attrs(ast) | 421 self._convert_ext_attrs(ast) |
| 431 # WebKit and Web IDL differ in how Optional is declared: | 422 # WebKit and Web IDL differ in how Optional is declared: |
| 432 self.is_optional = self._has(ast, 'Optional') \ | 423 self.is_optional = self._has(ast, 'Optional') \ |
| 433 or ('Optional' in self.ext_attrs) | 424 or ('Optional' in self.ext_attrs) |
| 434 | 425 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 460 """IDLDictNode specialization for one annotation.""" | 451 """IDLDictNode specialization for one annotation.""" |
| 461 def __init__(self, ast=None): | 452 def __init__(self, ast=None): |
| 462 IDLDictNode.__init__(self, ast) | 453 IDLDictNode.__init__(self, ast) |
| 463 self.id = None | 454 self.id = None |
| 464 if not ast: | 455 if not ast: |
| 465 return | 456 return |
| 466 for arg in self._find_all(ast, 'AnnotationArg'): | 457 for arg in self._find_all(ast, 'AnnotationArg'): |
| 467 name = self._find_first(arg, 'Id') | 458 name = self._find_first(arg, 'Id') |
| 468 value = self._find_first(arg, 'AnnotationArgValue') | 459 value = self._find_first(arg, 'AnnotationArgValue') |
| 469 self[name] = value | 460 self[name] = value |
| OLD | NEW |