Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(19748)

Issue 5694044: code review 5694044: encoding/xml: handle anonymous pointer fields (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by niemeyer
Modified:
11 years, 11 months ago
Reviewers:
CC:
golang-dev, rsc, gustavo_niemeyer.net
Visibility:
Public.

Description

encoding/xml: handle anonymous pointer fields This CL makes type T struct { *U } behave in a similar way to: type T struct { U } Fixes issue 3108.

Patch Set 1 #

Patch Set 2 : code review 5694044: encoding/xml: handle anonymous pointer fields #

Patch Set 3 : diff -r c33517ffaf1d https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 6c1797405851 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 6c1797405851 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 6c1797405851 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 7 : diff -r 4151d4de5a04 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 4151d4de5a04 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -18 lines) Patch
M src/pkg/encoding/xml/marshal.go View 1 2 3 4 5 6 4 chunks +5 lines, -5 lines 0 comments Download
M src/pkg/encoding/xml/marshal_test.go View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/encoding/xml/read.go View 1 2 3 4 5 6 5 chunks +9 lines, -9 lines 0 comments Download
M src/pkg/encoding/xml/typeinfo.go View 1 2 3 4 5 6 2 chunks +25 lines, -2 lines 0 comments Download

Messages

Total messages: 11
niemeyer
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 1 month ago (2012-02-23 03:19:04 UTC) #1
rsc
I'm sorry, but I think it's too late. Let's let xml sit and get pounded ...
12 years, 1 month ago (2012-02-23 03:25:28 UTC) #2
niemeyer
Hello golang-dev@googlegroups.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
12 years ago (2012-04-17 01:29:48 UTC) #3
rsc
Can you please describe what this CL does before I read the code? I was ...
11 years, 12 months ago (2012-04-25 02:52:29 UTC) #4
gustavo_niemeyer.net
On Tue, Apr 24, 2012 at 23:52, Russ Cox <rsc@golang.org> wrote: > Can you please ...
11 years, 12 months ago (2012-04-25 03:01:35 UTC) #5
rsc
I see. I thought xml was ignoring all anonymous fields. At the very least this ...
11 years, 12 months ago (2012-04-25 03:26:20 UTC) #6
gustavo_niemeyer.net
On Wed, Apr 25, 2012 at 00:25, Russ Cox <rsc@golang.org> wrote: > I see. I ...
11 years, 12 months ago (2012-04-25 03:47:12 UTC) #7
niemeyer
Hello golang-dev@googlegroups.com, rsc@golang.org, gustavo@niemeyer.net (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 12 months ago (2012-04-25 05:05:01 UTC) #8
niemeyer
ping
11 years, 11 months ago (2012-04-30 22:54:00 UTC) #9
rsc
LGTM http://codereview.appspot.com/5694044/diff/15001/src/pkg/encoding/xml/typeinfo.go File src/pkg/encoding/xml/typeinfo.go (right): http://codereview.appspot.com/5694044/diff/15001/src/pkg/encoding/xml/typeinfo.go#newcode70 src/pkg/encoding/xml/typeinfo.go:70: if t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Struct ...
11 years, 11 months ago (2012-05-01 22:49:46 UTC) #10
niemeyer
11 years, 11 months ago (2012-05-17 02:21:44 UTC) #11
*** Submitted as http://code.google.com/p/go/source/detail?r=7339b16a1f58 ***

encoding/xml: handle anonymous pointer fields

This CL makes

    type T struct { *U }

behave in a similar way to:

    type T struct { U }

Fixes issue 3108.

R=golang-dev, rsc, gustavo
CC=golang-dev
http://codereview.appspot.com/5694044

http://codereview.appspot.com/5694044/diff/15001/src/pkg/encoding/xml/typeinf...
File src/pkg/encoding/xml/typeinfo.go (right):

http://codereview.appspot.com/5694044/diff/15001/src/pkg/encoding/xml/typeinf...
src/pkg/encoding/xml/typeinfo.go:70: if t.Kind() == reflect.Ptr &&
t.Elem().Kind() == reflect.Struct {
On 2012/05/01 22:49:46, rsc wrote:
> You can make the cases less special by doing
> 
> if t.Kind() == reflect.Ptr {
>     t = t.Elem()
> }
> if t.Kind() != reflect.Struct {
>     continue
> }

Done.

http://codereview.appspot.com/5694044/diff/15001/src/pkg/encoding/xml/typeinf...
src/pkg/encoding/xml/typeinfo.go:334: // Value returns v's field value
corresponding to finfo.
On 2012/05/01 22:49:46, rsc wrote:
> Can you please call this 'value', so that it's obvious at call sites that it
is
> not an method usable by clients of this package?
> 

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b