Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Unified Diff: mojom/mojom_parser/parser/parse_driver.go

Issue 1423533003: Gives MojomFile a slice in order to store its imports in a specified order. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Improves comment. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojom/mojom_parser/mojom/types.go ('k') | mojom/mojom_parser/parser/parse_driver_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/parser/parse_driver.go
diff --git a/mojom/mojom_parser/parser/parse_driver.go b/mojom/mojom_parser/parser/parse_driver.go
index 17b6f1da968db2d49b8c71882e8c36be775bf480..f1784960bcbc134b668e48db48adfca59cb4a5b7 100644
--- a/mojom/mojom_parser/parser/parse_driver.go
+++ b/mojom/mojom_parser/parser/parse_driver.go
@@ -104,7 +104,7 @@ func (d *ParseDriver) ParseFiles(fileNames []string) (descriptor *mojom.MojomDes
// Note that we must do this even if the imported file has already been processed
// because a given file may be imported by multiple files and each of those need
// to be told about the absolute path of the imported file.
- currentFile.importedFrom.mojomFile.Imports[currentFile.specifiedPath] = currentFile.absolutePath
+ currentFile.importedFrom.mojomFile.SetCanonicalImportName(currentFile.specifiedPath, currentFile.absolutePath)
}
if !descriptor.ContainsFile(currentFile.absolutePath) {
@@ -129,14 +129,14 @@ func (d *ParseDriver) ParseFiles(fileNames []string) (descriptor *mojom.MojomDes
return
}
currentFile.mojomFile = d.fileExtractor.extractMojomFile(&parser)
- for importedFile, _ := range currentFile.mojomFile.Imports {
+ for _, importedFile := range currentFile.mojomFile.Imports {
// Note that it is important that we append all of the imported files here even
// if some of them have already been processed. That is because when the imported
// file is pulled from the queue it will be pre-processed during which time the
// absolute path to the file will be discovered and this absolute path will be
// set in |mojomFile| which is necessary for serializing mojomFile.
filesToProcess = append(filesToProcess,
- &FileReference{importedFrom: currentFile, specifiedPath: importedFile})
+ &FileReference{importedFrom: currentFile, specifiedPath: importedFile.SpecifiedName})
}
}
}
« no previous file with comments | « mojom/mojom_parser/mojom/types.go ('k') | mojom/mojom_parser/parser/parse_driver_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698