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

Delta Between Two Patch Sets: src/pkg/encoding/xml/typeinfo.go

Issue 12485044: code review 12485044: undo CL 12486043 / ab644299d124 (Closed)
Left Patch Set: Created 11 years, 7 months ago
Right Patch Set: diff -r ab644299d124 https://go.googlecode.com/hg/ Created 11 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/encoding/json/tags.go ('k') | src/pkg/encoding/xml/xml.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package xml 5 package xml
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "reflect" 9 "reflect"
10 "strings" 10 "strings"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 tinfoLock.Unlock() 106 tinfoLock.Unlock()
107 return tinfo, nil 107 return tinfo, nil
108 } 108 }
109 109
110 // structFieldInfo builds and returns a fieldInfo for f. 110 // structFieldInfo builds and returns a fieldInfo for f.
111 func structFieldInfo(typ reflect.Type, f *reflect.StructField) (*fieldInfo, erro r) { 111 func structFieldInfo(typ reflect.Type, f *reflect.StructField) (*fieldInfo, erro r) {
112 finfo := &fieldInfo{idx: f.Index} 112 finfo := &fieldInfo{idx: f.Index}
113 113
114 // Split the tag from the xml namespace if necessary. 114 // Split the tag from the xml namespace if necessary.
115 tag := f.Tag.Get("xml") 115 tag := f.Tag.Get("xml")
116 » if i := strings.IndexByte(tag, ' '); i >= 0 { 116 » if i := strings.Index(tag, " "); i >= 0 {
117 finfo.xmlns, tag = tag[:i], tag[i+1:] 117 finfo.xmlns, tag = tag[:i], tag[i+1:]
118 } 118 }
119 119
120 // Parse flags. 120 // Parse flags.
121 tokens := strings.Split(tag, ",") 121 tokens := strings.Split(tag, ",")
122 if len(tokens) == 1 { 122 if len(tokens) == 1 {
123 finfo.flags = fElement 123 finfo.flags = fElement
124 } else { 124 } else {
125 tag = tokens[0] 125 tag = tokens[0]
126 for _, flag := range tokens[1:] { 126 for _, flag := range tokens[1:] {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 if v.IsNil() { 351 if v.IsNil() {
352 v.Set(reflect.New(v.Type().Elem())) 352 v.Set(reflect.New(v.Type().Elem()))
353 } 353 }
354 v = v.Elem() 354 v = v.Elem()
355 } 355 }
356 } 356 }
357 v = v.Field(x) 357 v = v.Field(x)
358 } 358 }
359 return v 359 return v
360 } 360 }
LEFTRIGHT

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