• Sebastien Binet's avatar
    reflect: implement StructOf · 633ab742
    Sebastien Binet authored
    This change exposes a facility to create new struct types from a slice of
    reflect.StructFields.
    
    - reflect: first stab at implementing StructOf
    - reflect: tests for StructOf
    
    StructOf creates new struct types in the form of structTypeWithMethods
    to accomodate the GC (especially the uncommonType.methods slice field.)
    
    Creating struct types with embedded interfaces with unexported methods
    is not supported yet and will panic.
    Creating struct types with non-ASCII field names or types is not yet
    supported (see #15064.)
    
    Binaries' sizes for linux_amd64:
    
    old=tip (0104a31b)
    
                old bytes     new bytes     delta
    bin/go      9911336       9915456       +0.04%
    reflect     781704        830048        +6.18%
    
    Updates #5748.
    Updates #15064.
    
    Change-Id: I3b8fd4fadd6ce3b1b922e284f0ae72a3a8e3ce44
    Reviewed-on: https://go-review.googlesource.com/9251Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
    Run-TryBot: David Crawshaw <crawshaw@golang.org>
    633ab742
Name
Last commit
Last update
..
all_test.go Loading commit data...
asm_386.s Loading commit data...
asm_amd64.s Loading commit data...
asm_amd64p32.s Loading commit data...
asm_arm.s Loading commit data...
asm_arm64.s Loading commit data...
asm_mips64x.s Loading commit data...
asm_ppc64x.s Loading commit data...
deepequal.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
makefunc.go Loading commit data...
set_test.go Loading commit data...
tostring_test.go Loading commit data...
type.go Loading commit data...
value.go Loading commit data...