示例#1
0
文件: repr.go 项目: rainycape/gondola
func fieldRepr(s *gosym.Sym, typ reflect.Type, values []string, _html bool) (string, bool) {
	name := s.BaseName()
	repr := valRepr(s, typ, values, _html)
	if repr == "" {
		return "", false
	}
	return fmt.Sprintf("%s %s %s", name, typ, repr), true
}
示例#2
0
文件: locations.go 项目: vornet/delve
func (spec *FuncLocationSpec) Match(sym *gosym.Sym) bool {
	if spec.BaseName != sym.BaseName() {
		return false
	}

	recv := stripReceiverDecoration(sym.ReceiverName())
	if spec.ReceiverName != "" && spec.ReceiverName != recv {
		return false
	}
	if spec.PackageName != "" {
		if spec.AbsolutePackage {
			if spec.PackageName != sym.PackageName() {
				return false
			}
		} else {
			if !partialPathMatch(spec.PackageName, sym.PackageName()) {
				return false
			}
		}
	}
	if spec.PackageOrReceiverName != "" && !partialPathMatch(spec.PackageOrReceiverName, sym.PackageName()) && spec.PackageOrReceiverName != recv {
		return false
	}
	return true
}
示例#3
0
func (spec *FuncLocationSpec) Match(sym *gosym.Sym) bool {
	if spec.BaseName != sym.BaseName() {
		return false
	}

	recv := stripReceiverDecoration(sym.ReceiverName())
	if spec.ReceiverName != "" && spec.ReceiverName != recv {
		return false
	}
	if spec.PackageName != "" && spec.PackageName != sym.PackageName() {
		return false
	}
	if spec.PackageOrReceiverName != "" && spec.PackageOrReceiverName != sym.PackageName() && spec.PackageOrReceiverName != recv {
		return false
	}
	return true
}