當前位置: 首頁>>代碼示例>>Golang>>正文


Golang serial.Result類代碼示例

本文整理匯總了Golang中golang.org/x/tools/oracle/serial.Result的典型用法代碼示例。如果您正苦於以下問題:Golang Result類的具體用法?Golang Result怎麽用?Golang Result使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Result類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: toSerial

func (r *describePackageResult) toSerial(res *serial.Result, fset *token.FileSet) {
    var members []*serial.DescribeMember
    for _, mem := range r.members {
        typ := mem.obj.Type()
        var val string
        switch mem := mem.obj.(type) {
        case *types.Const:
            val = mem.Val().String()
        case *types.TypeName:
            typ = typ.Underlying()
        }
        members = append(members, &serial.DescribeMember{
            Name:    mem.obj.Name(),
            Type:    typ.String(),
            Value:   val,
            Pos:     fset.Position(mem.obj.Pos()).String(),
            Kind:    tokenOf(mem.obj),
            Methods: methodsToSerial(r.pkg, mem.methods, fset),
        })
    }
    res.Describe = &serial.Describe{
        Desc:   r.description,
        Pos:    fset.Position(r.node.Pos()).String(),
        Detail: "package",
        Package: &serial.DescribePackage{
            Path:    r.pkg.Path(),
            Members: members,
        },
    }
}
開發者ID:Lane391,項目名稱:golangdemo,代碼行數:30,代碼來源:describe.go

示例2: toSerial

func (r *implementsResult) toSerial(res *serial.Result, fset *token.FileSet) {
    res.Implements = &serial.Implements{
        T:                 makeImplementsType(r.t, fset),
        AssignableTo:      makeImplementsTypes(r.to, fset),
        AssignableFrom:    makeImplementsTypes(r.from, fset),
        AssignableFromPtr: makeImplementsTypes(r.fromPtr, fset),
    }
}
開發者ID:himanshugpt,項目名稱:evergreen,代碼行數:8,代碼來源:implements.go

示例3: toSerial

func (r *definitionResult) toSerial(res *serial.Result, fset *token.FileSet) {
    definition := &serial.Definition{
        Desc: r.obj.String(),
    }
    if pos := r.obj.Pos(); pos != token.NoPos { // Package objects have no Pos()
        definition.ObjPos = fset.Position(pos).String()
    }
    res.Definition = definition
}
開發者ID:dylanpoe,項目名稱:golang.org,代碼行數:9,代碼來源:definition14.go

示例4: toSerial

func (r *callersResult) toSerial(res *serial.Result, fset *token.FileSet) {
    var callers []serial.Caller
    for _, edge := range r.edges {
        callers = append(callers, serial.Caller{
            Caller: edge.Caller.Func.String(),
            Pos:    fset.Position(edge.Pos()).String(),
            Desc:   edge.Description(),
        })
    }
    res.Callers = callers
}
開發者ID:ChloeTigre,項目名稱:golang-tools,代碼行數:11,代碼來源:callers.go

示例5: toSerial

func (r *calleesResult) toSerial(res *serial.Result, fset *token.FileSet) {
    j := &serial.Callees{
        Pos:  fset.Position(r.site.Pos()).String(),
        Desc: r.site.Common().Description(),
    }
    for _, callee := range r.funcs {
        j.Callees = append(j.Callees, &serial.CalleesItem{
            Name: callee.String(),
            Pos:  fset.Position(callee.Pos()).String(),
        })
    }
    res.Callees = j
}
開發者ID:himanshugpt,項目名稱:evergreen,代碼行數:13,代碼來源:callees.go

示例6: toSerial

func (r *referrersResult) toSerial(res *serial.Result, fset *token.FileSet) {
    referrers := &serial.Referrers{
        Pos:  fset.Position(r.query.Pos()).String(),
        Desc: r.obj.String(),
    }
    if pos := r.obj.Pos(); pos != token.NoPos { // Package objects have no Pos()
        referrers.ObjPos = fset.Position(pos).String()
    }
    for _, ref := range r.refs {
        referrers.Refs = append(referrers.Refs, fset.Position(ref.NamePos).String())
    }
    res.Referrers = referrers
}
開發者ID:himanshugpt,項目名稱:evergreen,代碼行數:13,代碼來源:referrers.go

示例7: toSerial

func (r *freevarsResult) toSerial(res *serial.Result, fset *token.FileSet) {
    var refs []*serial.FreeVar
    for _, ref := range r.refs {
        refs = append(refs,
            &serial.FreeVar{
                Pos:  fset.Position(ref.obj.Pos()).String(),
                Kind: ref.kind,
                Ref:  ref.ref,
                Type: ref.typ.String(),
            })
    }
    res.Freevars = refs
}
開發者ID:ninokop,項目名稱:tools,代碼行數:13,代碼來源:freevars.go

示例8: toSerial

func (r *calleesTypesResult) toSerial(res *serial.Result, fset *token.FileSet) {
    j := &serial.Callees{
        Pos:  fset.Position(r.site.Pos()).String(),
        Desc: "static function call",
    }
    j.Callees = []*serial.CalleesItem{
        &serial.CalleesItem{
            Name: r.callee.FullName(),
            Pos:  fset.Position(r.callee.Pos()).String(),
        },
    }
    res.Callees = j
}
開發者ID:ChloeTigre,項目名稱:golang-tools,代碼行數:13,代碼來源:callees.go

示例9: toSerial

func (r *callgraphResult) toSerial(res *serial.Result, fset *token.FileSet) {
    cg := make([]serial.CallGraph, len(r.nodes))
    for _, n := range r.nodes {
        j := &cg[n.ID]
        fn := n.Func
        j.Name = fn.String()
        j.Pos = fset.Position(fn.Pos()).String()
        for callee := range callgraph.CalleesOf(n) {
            j.Children = append(j.Children, callee.ID)
        }
        sort.Ints(j.Children)
    }
    res.Callgraph = cg
}
開發者ID:dylanpoe,項目名稱:golang.org,代碼行數:14,代碼來源:callgraph.go

示例10: toSerial

func (r *whatResult) toSerial(res *serial.Result, fset *token.FileSet) {
    var enclosing []serial.SyntaxNode
    for _, n := range r.path {
        enclosing = append(enclosing, serial.SyntaxNode{
            Description: astutil.NodeDescription(n),
            Start:       fset.Position(n.Pos()).Offset,
            End:         fset.Position(n.End()).Offset,
        })
    }
    res.What = &serial.What{
        Modes:      r.modes,
        SrcDir:     r.srcdir,
        ImportPath: r.importPath,
        Enclosing:  enclosing,
    }
}
開發者ID:himanshugpt,項目名稱:evergreen,代碼行數:16,代碼來源:what.go

示例11: toSerial

func (r *callstackResult) toSerial(res *serial.Result, fset *token.FileSet) {
    var callers []serial.Caller
    for i := len(r.callpath) - 1; i >= 0; i-- { // (innermost first)
        edge := r.callpath[i]
        callers = append(callers, serial.Caller{
            Pos:    fset.Position(edge.Pos()).String(),
            Caller: edge.Caller.Func.String(),
            Desc:   edge.Description(),
        })
    }
    res.Callstack = &serial.CallStack{
        Pos:     fset.Position(r.target.Pos()).String(),
        Target:  r.target.String(),
        Callers: callers,
    }
}
開發者ID:2722,項目名稱:lantern,代碼行數:16,代碼來源:callstack.go

示例12: toSerial

func (r *implementsResult) toSerial(res *serial.Result, fset *token.FileSet) {
    res.Implements = &serial.Implements{
        T:                       makeImplementsType(r.t, fset),
        AssignableTo:            makeImplementsTypes(r.to, fset),
        AssignableFrom:          makeImplementsTypes(r.from, fset),
        AssignableFromPtr:       makeImplementsTypes(r.fromPtr, fset),
        AssignableToMethod:      methodsToSerial(r.qpos.info.Pkg, r.toMethod, fset),
        AssignableFromMethod:    methodsToSerial(r.qpos.info.Pkg, r.fromMethod, fset),
        AssignableFromPtrMethod: methodsToSerial(r.qpos.info.Pkg, r.fromPtrMethod, fset),
    }
    if r.method != nil {
        res.Implements.Method = &serial.DescribeMethod{
            Name: r.qpos.objectString(r.method),
            Pos:  fset.Position(r.method.Pos()).String(),
        }
    }
}
開發者ID:ChloeTigre,項目名稱:golang-tools,代碼行數:17,代碼來源:implements.go

示例13: toSerial

func (r *whicherrsResult) toSerial(res *serial.Result, fset *token.FileSet) {
    we := &serial.WhichErrs{}
    we.ErrPos = fset.Position(r.errpos).String()
    for _, g := range r.globals {
        we.Globals = append(we.Globals, fset.Position(g.Pos()).String())
    }
    for _, c := range r.consts {
        we.Constants = append(we.Constants, fset.Position(c.Pos()).String())
    }
    for _, t := range r.types {
        var et serial.WhichErrsType
        et.Type = r.qpos.typeString(t.typ)
        et.Position = fset.Position(t.obj.Pos()).String()
        we.Types = append(we.Types, et)
    }
    res.WhichErrs = we
}
開發者ID:ChloeTigre,項目名稱:golang-tools,代碼行數:17,代碼來源:whicherrs.go

示例14: toSerial

func (r *peersResult) toSerial(res *serial.Result, fset *token.FileSet) {
    peers := &serial.Peers{
        Pos:  fset.Position(r.queryPos).String(),
        Type: r.queryType.String(),
    }
    for _, alloc := range r.makes {
        peers.Allocs = append(peers.Allocs, fset.Position(alloc).String())
    }
    for _, send := range r.sends {
        peers.Sends = append(peers.Sends, fset.Position(send).String())
    }
    for _, receive := range r.receives {
        peers.Receives = append(peers.Receives, fset.Position(receive).String())
    }
    for _, clos := range r.closes {
        peers.Closes = append(peers.Closes, fset.Position(clos).String())
    }
    res.Peers = peers
}
開發者ID:Christeefym,項目名稱:lantern,代碼行數:19,代碼來源:peers.go

示例15: toSerial

func (r *pointstoResult) toSerial(res *serial.Result, fset *token.FileSet) {
    var pts []serial.PointsTo
    for _, ptr := range r.ptrs {
        var namePos string
        if nt, ok := deref(ptr.typ).(*types.Named); ok {
            namePos = fset.Position(nt.Obj().Pos()).String()
        }
        var labels []serial.PointsToLabel
        for _, l := range ptr.labels {
            labels = append(labels, serial.PointsToLabel{
                Pos:  fset.Position(l.Pos()).String(),
                Desc: l.String(),
            })
        }
        pts = append(pts, serial.PointsTo{
            Type:    r.qpos.typeString(ptr.typ),
            NamePos: namePos,
            Labels:  labels,
        })
    }
    res.PointsTo = pts
}
開發者ID:ChloeTigre,項目名稱:golang-tools,代碼行數:22,代碼來源:pointsto.go


注:本文中的golang.org/x/tools/oracle/serial.Result類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。