Skip to content

Commit

Permalink
#patch conversion of number to string to make AST more readable (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
pandurangpatil authored Jun 30, 2023
1 parent 9961077 commit 7d6b44c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion goastgen/libgoastgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ func processStruct(node interface{}, objPtrValue reflect.Value, fset *token.File
if value.IsValid() {
switch fieldKind {
case reflect.String, reflect.Int, reflect.Bool, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Float32, reflect.Float64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
objectMap[field.Name] = value.Interface()
if value.Type().String() == "token.Token" {
objectMap[field.Name] = value.Interface().(token.Token).String()
} else {
objectMap[field.Name] = value.Interface()
}
case reflect.Struct:
objectMap[field.Name] = processStruct(value.Interface(), ptrValue, fset, lastNodeId, nodeAddressMap)
case reflect.Map:
Expand Down

0 comments on commit 7d6b44c

Please sign in to comment.