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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 mojom 5 package mojom
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 ) 9 )
10 10
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 } 467 }
468 468
469 /////////////////////////////////////////////////////////////////////// 469 ///////////////////////////////////////////////////////////////////////
470 /// Miscelleneous utilities 470 /// Miscelleneous utilities
471 /// ////////////////////////////////////////////////////////////////// 471 /// //////////////////////////////////////////////////////////////////
472 472
473 func computeTypeKey(fullyQualifiedName string) (typeKey string) { 473 func computeTypeKey(fullyQualifiedName string) (typeKey string) {
474 if typeKey, ok := fqnToTypeKey[fullyQualifiedName]; ok == true { 474 if typeKey, ok := fqnToTypeKey[fullyQualifiedName]; ok == true {
475 return typeKey 475 return typeKey
476 } 476 }
477 » typeKey = fmt.Sprintf("%d", nextKey) 477 » // TODO(rudominer) Until we understand better what the requirements are for a type key
478 » nextKey++ 478 » // let's just use the fully-qualified name itself, with a prefix prepend ed, as the type key.
479 » // The reason or the prefix is pragmatic: When debugging we can tell whe ther a string
480 » // is a type key or a fully-qualified-name.
481 » typeKey = fmt.Sprintf("TYPE_KEY:%s", fullyQualifiedName)
479 fqnToTypeKey[fullyQualifiedName] = typeKey 482 fqnToTypeKey[fullyQualifiedName] = typeKey
480 return 483 return
481 } 484 }
482 485
483 var fqnToTypeKey map[string]string 486 var fqnToTypeKey map[string]string
484 var nextKey int
485 487
486 func init() { 488 func init() {
487 fqnToTypeKey = make(map[string]string) 489 fqnToTypeKey = make(map[string]string)
488 } 490 }
OLDNEW
« 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