代码拉取完成,页面将自动刷新
package gotype
func newTypeValueBind(typ, val Type, info *info) Type {
switch typ.Kind() {
case Struct:
if v, ok := val.(*typeValuePairs); ok {
nt := &typeStruct{}
fl := typ.NumField()
for i := 0; i != fl; i++ {
f := typ.Field(i)
name := f.Name()
b := f
if val, ok := v.li.Search(name); ok {
b = newTypeValueBind(f, val, info)
}
nt.fields = append(nt.fields, b)
}
return nt
}
case Declaration:
name := typ.Name()
t := newTypeValueBind(typ.Declaration(), val, info)
if typ.Origin() != nil {
t = newTypeOrigin(t, typ.Origin(), info, typ.Doc(), typ.Comment())
}
return newDeclaration(name, t)
}
return newValueBind(typ, val.Value)
}
func newValueBind(typ Type, valfunc func() string) *typeValueBind {
if tv, ok := typ.(*typeValueBind); ok {
return newValueBind(tv.Type, tv.Value)
}
return &typeValueBind{
Type: typ,
valfunc: valfunc,
}
}
func newEvalBind(val Type, index int64, info *info) Type {
ori := val.Origin()
val = newValueBind(val, func() string {
v, err := constantEval(ori, int64(index), info)
if err != nil {
return ""
}
return v.ExactString()
})
return val
}
type typeValueBind struct {
Type
valfunc func() string
val string
}
func (t *typeValueBind) Value() string {
if t.val == "" {
t.val = t.valfunc()
}
return t.val
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。