Chromium Code Reviews| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 class IDLFile(IDLNode): | 251 class IDLFile(IDLNode): |
| 252 """IDLFile is the top-level node in each IDL file. It may contain interfaces." "" | 252 """IDLFile is the top-level node in each IDL file. It may contain interfaces." "" |
| 253 | 253 |
| 254 def __init__(self, ast, filename=None): | 254 def __init__(self, ast, filename=None): |
| 255 IDLNode.__init__(self, ast) | 255 IDLNode.__init__(self, ast) |
| 256 self.filename = filename | 256 self.filename = filename |
| 257 self.interfaces = self._convert_all(ast, 'Interface', IDLInterface) | 257 self.interfaces = self._convert_all(ast, 'Interface', IDLInterface) |
| 258 modules = self._convert_all(ast, 'Module', IDLModule) | 258 modules = self._convert_all(ast, 'Module', IDLModule) |
| 259 self.implementsStatements = self._convert_all(ast, 'ImplStmt', | 259 self.implementsStatements = self._convert_all(ast, 'ImplStmt', |
| 260 IDLImplementsStatement) | 260 IDLImplementsStatement) |
| 261 self.typeDefs = self._convert_all(ast, 'TypeDef', IDLTypeDef) | |
| 261 for module in modules: | 262 for module in modules: |
| 262 self.interfaces.extend(module.interfaces) | 263 self.interfaces.extend(module.interfaces) |
| 263 self.implementsStatements.extend(module.implementsStatements) | 264 self.implementsStatements.extend(module.implementsStatements) |
| 265 self.typeDefs.exted(module.typeDefs) | |
|
Mads Ager (google)
2013/02/27 15:47:22
extend
Anton Muhin
2013/02/27 15:48:48
thanks!
Anton Muhin
2013/02/27 15:48:48
thanks!
| |
| 264 | 266 |
| 265 | 267 |
| 266 class IDLModule(IDLNode): | 268 class IDLModule(IDLNode): |
| 267 """IDLModule has an id, and may contain interfaces, type defs and | 269 """IDLModule has an id, and may contain interfaces, type defs and |
| 268 implements statements.""" | 270 implements statements.""" |
| 269 def __init__(self, ast): | 271 def __init__(self, ast): |
| 270 IDLNode.__init__(self, ast) | 272 IDLNode.__init__(self, ast) |
| 271 self._convert_ext_attrs(ast) | 273 self._convert_ext_attrs(ast) |
| 272 self._convert_annotations(ast) | 274 self._convert_annotations(ast) |
| 273 self.interfaces = self._convert_all(ast, 'Interface', IDLInterface) | 275 self.interfaces = self._convert_all(ast, 'Interface', IDLInterface) |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 """IDLDictNode specialization for one annotation.""" | 526 """IDLDictNode specialization for one annotation.""" |
| 525 def __init__(self, ast=None): | 527 def __init__(self, ast=None): |
| 526 IDLDictNode.__init__(self, ast) | 528 IDLDictNode.__init__(self, ast) |
| 527 self.id = None | 529 self.id = None |
| 528 if not ast: | 530 if not ast: |
| 529 return | 531 return |
| 530 for arg in self._find_all(ast, 'AnnotationArg'): | 532 for arg in self._find_all(ast, 'AnnotationArg'): |
| 531 name = self._find_first(arg, 'Id') | 533 name = self._find_first(arg, 'Id') |
| 532 value = self._find_first(arg, 'AnnotationArgValue') | 534 value = self._find_first(arg, 'AnnotationArgValue') |
| 533 self[name] = value | 535 self[name] = value |
| OLD | NEW |