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..12aff355cf4d820a32358b60dc14fb76217c28b5 100644 |
--- a/mojom/mojom_parser/mojom/mojom_descriptor.go |
+++ b/mojom/mojom_parser/mojom/mojom_descriptor.go |
@@ -474,14 +474,21 @@ 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 reversed fully-qualified name as the type key. The reason |
+ // for the reversal is pragmatic: When debugging we can tell whether a string |
mattr
2015/11/10 19:26:49
Reversing seems an odd way to mark the name, you c
rudominer
2015/11/10 23:29:35
Good idea. Thanks. Done.
|
+ // is a type key or a fully-qualified-name |
+ numBytes := len(fullyQualifiedName) |
+ reversed := make([]byte, numBytes) |
+ for i := 0; i < numBytes; i++ { |
+ reversed[i] = fullyQualifiedName[numBytes-i-1] |
+ } |
+ typeKey = string(reversed) |
fqnToTypeKey[fullyQualifiedName] = typeKey |
return |
} |
var fqnToTypeKey map[string]string |
-var nextKey int |
func init() { |
fqnToTypeKey = make(map[string]string) |