Esempio n. 1
0
func containsMethod(m *st.FunctionSymbol, sym st.ITypeSymbol) (bool, *errors.GoRefactorError) {
	candidate, ok := sym.Methods().LookUp(m.Name(), "")
	if !ok {
		return false, nil
	}
	cand, ok := candidate.(*st.FunctionSymbol)
	if !ok {
		panic("non-method symbol " + candidate.Name() + " in type " + sym.Name() + " methods()")
	}

	if !st.EqualsMethods(cand, m) {
		return true, &errors.GoRefactorError{ErrorType: "implement interface error", Message: "type has a method, named " + cand.Name() + "but it has signature, different from the necessary one"}
	}

	return true, nil
}
Esempio n. 2
0
func (pp *packageParser) fixFunctionSymbol(t *st.FunctionSymbol) {
	if uts, ok := t.FunctionType.(*st.UnresolvedTypeSymbol); ok {
		//pp.CurrentFileName = pp.Package.FileSet.Position(uts.Declaration.Pos()).Filename
		t.FunctionType = pp.resolveType(uts)
		pp.moveData(t.FunctionType, uts)
	}
	pp.fixType(t.FunctionType)

}