本文整理汇总了Golang中golang.org/x/tools/refactor/satisfy.Finder类的典型用法代码示例。如果您正苦于以下问题:Golang Finder类的具体用法?Golang Finder怎么用?Golang Finder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Finder类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: satisfy
// satisfy returns the set of interface satisfaction constraints.
func (r *Unexporter) satisfy() map[satisfy.Constraint]bool {
if r.satisfyConstraints == nil {
// Compute on demand: it's expensive.
var f satisfy.Finder
for _, info := range r.packages {
f.Find(&info.Info, info.Files)
}
r.satisfyConstraints = f.Result
}
return r.satisfyConstraints
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:12,代码来源:check.go
示例2: calculateConstraints
func calculateConstraints(u *Unexporter) {
constraints := make(map[satisfy.Constraint]map[*types.Package]bool)
for _, info := range u.prog.Imported {
var finder satisfy.Finder
finder.Find(&info.Info, info.Files)
for constraint := range finder.Result {
if _, ok := constraints[constraint]; !ok {
constraints[constraint] = make(map[*types.Package]bool)
}
constraints[constraint][info.Pkg] = true
}
}
u.f = constraints
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:16,代码来源:unexporter.go
示例3: findAssignments
// findAssignments returns the set of types to or from which type T is
// assigned in the program syntax.
func (r *renamer) findAssignments(T types.Type) map[types.Type]bool {
if r.satisfyConstraints == nil {
// Compute on demand: it's expensive.
var f satisfy.Finder
for _, info := range r.packages {
f.Find(&info.Info, info.Files)
}
r.satisfyConstraints = f.Result
}
result := make(map[types.Type]bool)
for key := range r.satisfyConstraints {
// key = (lhs, rhs) where lhs is always an interface.
if types.Identical(key.RHS, T) {
result[key.LHS] = true
}
if isInterface(T) && types.Identical(key.LHS, T) {
// must check both sides
result[key.RHS] = true
}
}
return result
}
开发者ID:himanshugpt,项目名称:evergreen,代码行数:25,代码来源:check.go
注:本文中的golang.org/x/tools/refactor/satisfy.Finder类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论