Skip to content

Commit bb506c1

Browse files
committed
rename
1 parent 53df8a8 commit bb506c1

File tree

9 files changed

+38
-38
lines changed

9 files changed

+38
-38
lines changed

parser_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (r *parser) EvalType(expr ast.Expr) Type {
106106
if v.Names == nil {
107107
t := &typeStructField{
108108
name: ty.Name(),
109-
typ: ty,
109+
elem: ty,
110110
tag: tag,
111111
}
112112
s.anonymo.Add(t)
@@ -115,7 +115,7 @@ func (r *parser) EvalType(expr ast.Expr) Type {
115115
for _, name := range v.Names {
116116
t := &typeStructField{
117117
name: name.Name,
118-
typ: ty,
118+
elem: ty,
119119
tag: tag,
120120
}
121121
s.fields.Add(t)

types_array.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ import "fmt"
44

55
func newTypeArray(v Type, l int) Type {
66
return &typeArray{
7-
val: v,
8-
le: l,
7+
elem: v,
8+
le: l,
99
}
1010
}
1111

1212
type typeArray struct {
1313
typeBase
14-
le int
15-
val Type
14+
le int
15+
elem Type
1616
}
1717

1818
func (t *typeArray) String() string {
19-
return fmt.Sprintf("[%v]%v", t.le, t.val)
19+
return fmt.Sprintf("[%v]%v", t.le, t.elem)
2020
}
2121

2222
func (t *typeArray) Kind() Kind {
2323
return Array
2424
}
2525

2626
func (t *typeArray) Elem() Type {
27-
return t.val
27+
return t.elem
2828
}
2929

3030
func (t *typeArray) Len() int {

types_chan.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@ import "fmt"
44

55
func newTypeChan(v Type, dir ChanDir) Type {
66
return &typeChan{
7-
val: v,
8-
dir: dir,
7+
elem: v,
8+
dir: dir,
99
}
1010
}
1111

1212
type typeChan struct {
1313
typeBase
14-
dir ChanDir
15-
val Type
14+
dir ChanDir
15+
elem Type
1616
}
1717

1818
func (t *typeChan) String() string {
1919
switch t.dir {
2020
case RecvDir:
21-
return fmt.Sprintf("<-chan %v", t.val)
21+
return fmt.Sprintf("<-chan %v", t.elem)
2222
case SendDir:
23-
return fmt.Sprintf("chan<- %v", t.val)
23+
return fmt.Sprintf("chan<- %v", t.elem)
2424
case BothDir:
2525
}
26-
return fmt.Sprintf("chan %v", t.val)
26+
return fmt.Sprintf("chan %v", t.elem)
2727
}
2828

2929
func (t *typeChan) Kind() Kind {
3030
return Chan
3131
}
3232

3333
func (t *typeChan) Elem() Type {
34-
return t.val
34+
return t.elem
3535
}
3636

3737
func (t *typeChan) ChanDir() ChanDir {

types_func.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ func (t *typeFunc) String() string {
1818
}
1919
if t.variadic && i+1 == len(t.results) {
2020
if d, ok := v.(*typeVar); ok {
21-
if d0, ok := d.typ.(*typeSlice); ok {
21+
if d0, ok := d.elem.(*typeSlice); ok {
2222
buf.WriteString(d.name)
2323
buf.WriteString(" ...")
24-
buf.WriteString(d0.val.String())
24+
buf.WriteString(d0.elem.String())
2525
continue
2626
}
2727
}

types_map.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import "fmt"
44

55
func newTypeMap(k, v Type) Type {
66
return &typeMap{
7-
key: k,
8-
val: v,
7+
key: k,
8+
elem: v,
99
}
1010
}
1111

1212
type typeMap struct {
1313
typeBase
14-
key, val Type
14+
key, elem Type
1515
}
1616

1717
func (t *typeMap) String() string {
18-
return fmt.Sprintf("map[%v]%v", t.key, t.val)
18+
return fmt.Sprintf("map[%v]%v", t.key, t.elem)
1919
}
2020

2121
func (t *typeMap) Kind() Kind {
@@ -27,5 +27,5 @@ func (t *typeMap) Key() Type {
2727
}
2828

2929
func (t *typeMap) Elem() Type {
30-
return t.val
30+
return t.elem
3131
}

types_ptr.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ import "fmt"
44

55
func newTypePtr(elem Type) Type {
66
return &typePtr{
7-
typ: elem,
7+
elem: elem,
88
}
99
}
1010

1111
type typePtr struct {
1212
typeBase
13-
typ Type
13+
elem Type
1414
}
1515

1616
func (t *typePtr) String() string {
17-
return fmt.Sprintf("*%v", t.typ)
17+
return fmt.Sprintf("*%v", t.elem)
1818
}
1919

2020
func (y *typePtr) Kind() Kind {
2121
return Ptr
2222
}
2323

2424
func (t *typePtr) Elem() Type {
25-
return t.typ
25+
return t.elem
2626
}

types_slice.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ import (
66

77
func newTypeSlice(v Type) Type {
88
return &typeSlice{
9-
val: v,
9+
elem: v,
1010
}
1111
}
1212

1313
type typeSlice struct {
1414
typeBase
15-
val Type
15+
elem Type
1616
}
1717

1818
func (t *typeSlice) String() string {
19-
return fmt.Sprintf("[]%v", t.val.String())
19+
return fmt.Sprintf("[]%v", t.elem.String())
2020
}
2121

2222
func (t *typeSlice) Kind() Kind {
2323
return Slice
2424
}
2525

2626
func (t *typeSlice) Elem() Type {
27-
return t.val
27+
return t.elem
2828
}

types_struct_field.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ import (
88
type typeStructField struct {
99
typeBase
1010
name string
11-
typ Type // 字段类型
11+
elem Type // 字段类型
1212
tag reflect.StructTag // 字段标签
1313
}
1414

1515
func (t *typeStructField) String() string {
16-
return fmt.Sprintf("%v %v %v", t.name, t.typ, t.tag)
16+
return fmt.Sprintf("%v %v %v", t.name, t.elem, t.tag)
1717
}
1818

1919
func (t *typeStructField) Name() string {
2020
return t.name
2121
}
2222

2323
func (t *typeStructField) Elem() Type {
24-
return t.typ
24+
return t.elem
2525
}
2626

2727
func (t *typeStructField) Kind() Kind {

types_var.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ func newTypeVar(name string, typ Type) *typeVar {
55
if ok {
66
return &typeVar{
77
name: name,
8-
typ: v.typ,
8+
elem: v.elem,
99
}
1010
}
1111
return &typeVar{
1212
name: name,
13-
typ: typ,
13+
elem: typ,
1414
}
1515
}
1616

1717
type typeVar struct {
1818
typeBase
19-
typ Type
19+
elem Type
2020
name string
2121
}
2222

@@ -33,5 +33,5 @@ func (t *typeVar) Kind() Kind {
3333
}
3434

3535
func (t *typeVar) Elem() Type {
36-
return t.typ
36+
return t.elem
3737
}

0 commit comments

Comments
 (0)