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

Unified Diff: mojom/mojom_parser/mojom/mojom_descriptor.go

Issue 1421193003: New Mojom Parser: Serialization. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Refactors TestSingleFileSerialization. Created 5 years, 1 month 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
Index: mojom/mojom_parser/mojom/mojom_descriptor.go
diff --git a/mojom/mojom_parser/mojom/mojom_descriptor.go b/mojom/mojom_parser/mojom/mojom_descriptor.go
index 4ecac5fb01fa75d4122e2a846e18f348660629cd..3109654c9aeacef0b48ccc93e1737e131dbd5ce3 100644
--- a/mojom/mojom_parser/mojom/mojom_descriptor.go
+++ b/mojom/mojom_parser/mojom/mojom_descriptor.go
@@ -474,14 +474,16 @@ func computeTypeKey(fullyQualifiedName string) (typeKey string) {
if typeKey, ok := fqnToTypeKey[fullyQualifiedName]; ok == true {
return typeKey
}
- typeKey = fmt.Sprintf("%d", nextKey)
- nextKey++
+ // TODO(rudominer) Until we understand better what the requirements are for a type key
+ // let's just use the fully-qualified name itself, with a prefix prepended, as the type key.
+ // The reason or the prefix is pragmatic: When debugging we can tell whether a string
+ // is a type key or a fully-qualified-name.
+ typeKey = fmt.Sprintf("TYPE_KEY:%s", fullyQualifiedName)
fqnToTypeKey[fullyQualifiedName] = typeKey
return
}
var fqnToTypeKey map[string]string
-var nextKey int
func init() {
fqnToTypeKey = make(map[string]string)
« no previous file with comments | « mojom/mojom_parser/generated/mojom_types/mojom_types.mojom.go ('k') | mojom/mojom_parser/serialization/serialization.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698