本文整理汇总了Golang中code/google/com/p/go/tools/oracle/serial.Result类的典型用法代码示例。如果您正苦于以下问题:Golang Result类的具体用法?Golang Result怎么用?Golang Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Result类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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:Karthikvb,项目名称:15640_projects,代码行数: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:ufo22940268,项目名称:two-server-others,代码行数: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:4honor,项目名称:obdi,代码行数:9,代码来源:definition.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:4honor,项目名称:obdi,代码行数:11,代码来源:callers.go
示例5: toSerial
func (r *implementsResult) toSerial(res *serial.Result, fset *token.FileSet) {
var facts []*serial.Implements
for _, fact := range r.facts {
facts = append(facts, &serial.Implements{
I: fact.iface.String(),
IPos: fset.Position(fact.iface.Obj().Pos()).String(),
C: fact.conc.String(),
CPos: fset.Position(deref(fact.conc).(*types.Named).Obj().Pos()).String(),
})
}
res.Implements = facts
}
开发者ID:Bosh-for-Cpi,项目名称:bosh-2605,代码行数:12,代码来源:implements.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:Karthikvb,项目名称:15640_projects,代码行数:13,代码来源:referrers.go
示例7: 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:ufo22940268,项目名称:two-server-others,代码行数:13,代码来源:callees.go
示例8: 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:4honor,项目名称:obdi,代码行数:13,代码来源:freevars.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:Karthikvb,项目名称:15640_projects,代码行数:14,代码来源:callgraph.go
示例10: 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())
}
res.Peers = peers
}
开发者ID:Karthikvb,项目名称:15640_projects,代码行数:16,代码来源:peers.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.Site.Pos()).String(),
Caller: edge.Caller.Func().String(),
Desc: edge.Site.Common().Description(),
})
}
res.Callstack = &serial.CallStack{
Pos: fset.Position(r.target.Pos()).String(),
Target: r.target.String(),
Callers: callers,
}
}
开发者ID:amulyas,项目名称:bosh-cloudstack-cpi,代码行数:16,代码来源:callstack.go
示例12: toSerial
func (r *callersResult) toSerial(res *serial.Result, fset *token.FileSet) {
root := r.callgraph.Root()
var callers []serial.Caller
for _, edge := range r.edges {
var c serial.Caller
c.Caller = edge.Caller.Func().String()
if edge.Caller == root {
c.Desc = "synthetic call"
} else {
c.Pos = fset.Position(edge.Site.Pos()).String()
c.Desc = edge.Site.Common().Description()
}
callers = append(callers, c)
}
res.Callers = callers
}
开发者ID:amulyas,项目名称:bosh-cloudstack-cpi,代码行数:16,代码来源:callers.go
示例13: 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:samuelyao314,项目名称:mygo,代码行数:16,代码来源:what.go
示例14: toSerial
func (r *describeValueResult) toSerial(res *serial.Result, fset *token.FileSet) {
var value, objpos, ptaerr string
if r.constVal != nil {
value = r.constVal.String()
}
if r.obj != nil {
objpos = fset.Position(r.obj.Pos()).String()
}
if r.ptaErr != nil {
ptaerr = r.ptaErr.Error()
}
var pts []*serial.DescribePointer
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.DescribePTALabel
for _, l := range ptr.labels {
labels = append(labels, serial.DescribePTALabel{
Pos: fset.Position(l.Pos()).String(),
Desc: l.String(),
})
}
pts = append(pts, &serial.DescribePointer{
Type: ptr.typ.String(),
NamePos: namePos,
Labels: labels,
})
}
res.Describe = &serial.Describe{
Desc: importer.NodeDescription(r.expr),
Pos: fset.Position(r.expr.Pos()).String(),
Detail: "value",
Value: &serial.DescribeValue{
Type: r.typ.String(),
Value: value,
ObjPos: objpos,
PTAErr: ptaerr,
PTS: pts,
},
}
}
开发者ID:nagyistge,项目名称:hm-workspace,代码行数:45,代码来源:describe.go
示例15: toSerial
func (r *callgraphResult) toSerial(res *serial.Result, fset *token.FileSet) {
nodes := r.callgraph.Nodes()
numbering := make(map[call.GraphNode]int)
for i, n := range nodes {
numbering[n] = i
}
cg := make([]serial.CallGraph, len(nodes))
for i, n := range nodes {
j := &cg[i]
fn := n.Func()
j.Name = fn.String()
j.Pos = fset.Position(fn.Pos()).String()
for callee := range call.CalleesOf(n) {
j.Children = append(j.Children, numbering[callee])
}
}
res.Callgraph = cg
}
开发者ID:amulyas,项目名称:bosh-cloudstack-cpi,代码行数:20,代码来源:callgraph.go
示例16: 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:ufo22940268,项目名称:two-server-others,代码行数:22,代码来源:pointsto.go
注:本文中的code/google/com/p/go/tools/oracle/serial.Result类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论