| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Convert parse tree to AST. | 5 """Convert parse tree to AST. |
| 6 | 6 |
| 7 This module converts the parse tree to the AST we use for code generation. The | 7 This module converts the parse tree to the AST we use for code generation. The |
| 8 main entry point is OrderedModule, which gets passed the parser | 8 main entry point is OrderedModule, which gets passed the parser |
| 9 representation of a mojom file. When called it's assumed that all imports have | 9 representation of a mojom file. When called it's assumed that all imports have |
| 10 already been parsed and converted to ASTs before. | 10 already been parsed and converted to ASTs before. |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 Args: | 601 Args: |
| 602 tree: {ast.Mojom} The parse tree. | 602 tree: {ast.Mojom} The parse tree. |
| 603 name: {str} The mojom filename, excluding the path. | 603 name: {str} The mojom filename, excluding the path. |
| 604 imports: {Dict[str, mojom.Module]} Mapping from filenames, as they appear in | 604 imports: {Dict[str, mojom.Module]} Mapping from filenames, as they appear in |
| 605 the import list, to already processed modules. Used to process imports. | 605 the import list, to already processed modules. Used to process imports. |
| 606 | 606 |
| 607 Returns: | 607 Returns: |
| 608 {mojom.Module} An AST for the mojom. | 608 {mojom.Module} An AST for the mojom. |
| 609 """ | 609 """ |
| 610 module = _Module(tree, name, imports) | 610 module = _Module(tree, name, imports) |
| 611 for interface in module.interfaces: | |
| 612 next_ordinal = 0 | |
| 613 for method in interface.methods: | |
| 614 if method.ordinal is None: | |
| 615 method.ordinal = next_ordinal | |
| 616 next_ordinal = method.ordinal + 1 | |
| 617 return module | 611 return module |
| OLD | NEW |