| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package common | 5 package common |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 » "mojom/mojom_tool/generated/mojom_files" | 8 » "mojom/generated/mojom_files" |
| 9 ) | 9 ) |
| 10 | 10 |
| 11 // common groups together functions which make it easier for generators | 11 // common groups together functions which make it easier for generators |
| 12 // implemented in go to implement the same interface. | 12 // implemented in go to implement the same interface. |
| 13 | 13 |
| 14 // GeneratorConfig is used to specify configuration for a generator. | 14 // GeneratorConfig is used to specify configuration for a generator. |
| 15 type GeneratorConfig interface { | 15 type GeneratorConfig interface { |
| 16 // FileGraph returns a parsed MojomFileGraph. | 16 // FileGraph returns a parsed MojomFileGraph. |
| 17 FileGraph() *mojom_files.MojomFileGraph | 17 FileGraph() *mojom_files.MojomFileGraph |
| 18 | 18 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 // GenerateOutput iterates through the files in the file graph in |config| and | 48 // GenerateOutput iterates through the files in the file graph in |config| and |
| 49 // for all the files for which an output should be generated, it uses | 49 // for all the files for which an output should be generated, it uses |
| 50 // writeOutput to write the generated output. | 50 // writeOutput to write the generated output. |
| 51 func GenerateOutput(writeOutput writeOutput, config GeneratorConfig) { | 51 func GenerateOutput(writeOutput writeOutput, config GeneratorConfig) { |
| 52 for fileName, file := range config.FileGraph().Files { | 52 for fileName, file := range config.FileGraph().Files { |
| 53 if config.GenImports() || *file.SpecifiedFileName != "" { | 53 if config.GenImports() || *file.SpecifiedFileName != "" { |
| 54 writeOutput(fileName, config) | 54 writeOutput(fileName, config) |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 } | 57 } |
| OLD | NEW |