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

Side by Side Diff: mojom/mojom_tool/serialization/serialization.go

Issue 2005343003: Mojom compiler frontend: Change the type of the |offset| field to uint32. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « mojom/generated/mojom_types/mojom_types.mojom.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 serialization 5 package serialization
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "compress/gzip" 9 "compress/gzip"
10 "encoding/base64" 10 "encoding/base64"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 } 316 }
317 317
318 func translateStructField(f *mojom.StructField) (field mojom_types.StructField) { 318 func translateStructField(f *mojom.StructField) (field mojom_types.StructField) {
319 field.DeclData = translateDeclarationData(&f.DeclarationData) 319 field.DeclData = translateDeclarationData(&f.DeclarationData)
320 field.Type = translateTypeRef(f.FieldType) 320 field.Type = translateTypeRef(f.FieldType)
321 if f.DefaultValue != nil { 321 if f.DefaultValue != nil {
322 field.DefaultValue = translateDefaultFieldValue(f.DefaultValue) 322 field.DefaultValue = translateDefaultFieldValue(f.DefaultValue)
323 } 323 }
324 if emitComputedPackingData { 324 if emitComputedPackingData {
325 » » // TODO(rudominer) Check the allowed size of offsets. The type u sed in 325 » » field.Offset = f.Offset()
326 » » // mojom_types.mojom might need to be changed.
327 » » field.Offset = int32(f.Offset())
328 field.Bit = int8(f.Bit()) 326 field.Bit = int8(f.Bit())
329 field.MinVersion = f.MinVersion() 327 field.MinVersion = f.MinVersion()
330 } 328 }
331 return 329 return
332 } 330 }
333 331
334 func translateDefaultFieldValue(v mojom.ValueRef) mojom_types.DefaultFieldValue { 332 func translateDefaultFieldValue(v mojom.ValueRef) mojom_types.DefaultFieldValue {
335 switch v := v.(type) { 333 switch v := v.(type) {
336 case mojom.LiteralValue: 334 case mojom.LiteralValue:
337 if v.IsDefault() { 335 if v.IsDefault() {
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 745
748 // stringPointer is a convenience function for creating a pointer to a string wh ose value 746 // stringPointer is a convenience function for creating a pointer to a string wh ose value
749 // is the specified string. It may be used in situations where the compiler will 747 // is the specified string. It may be used in situations where the compiler will
750 // not allow you to take the address of a string value directly, such as the 748 // not allow you to take the address of a string value directly, such as the
751 // return value of a function. It is necessary to create pointers to strings bec ause 749 // return value of a function. It is necessary to create pointers to strings bec ause
752 // that is how the Mojom type |string?| (i.e. nullable string) is represented in 750 // that is how the Mojom type |string?| (i.e. nullable string) is represented in
753 // in the Mojom Go bindings. 751 // in the Mojom Go bindings.
754 func stringPointer(s string) *string { 752 func stringPointer(s string) *string {
755 return &s 753 return &s
756 } 754 }
OLDNEW
« no previous file with comments | « mojom/generated/mojom_types/mojom_types.mojom.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698