func ParseExpr(expr ast.Expr, pack *st.Package, filename string, identMap st.IdentifierMap) st.ITypeSymbol { pp := newPackageParser(pack, identMap) pp.CurrentFileName = filename pp.Mode = REFACTORING_MODE v := pp.parseExpr(expr) if len(*v) == 0 { return st.MakeInterfaceType(st.NO_NAME, pack.Symbols) } if t, ok := v.At(0).(st.ITypeSymbol); ok { return t } return st.MakeInterfaceType(st.NO_NAME, pack.Symbols) }
func (pp *packageParser) tParseInterfaceType(t *ast.InterfaceType) (result *st.InterfaceTypeSymbol) { result = st.MakeInterfaceType(st.NO_NAME, pp.CurrentSymbolTable) if len(t.Methods.List) > 0 { for _, method := range t.Methods.List { if len(method.Names) == 0 { //Embeded interface ft := pp.parseTypeSymbol(method.Type) result.AddMethod(ft) } for _, name := range method.Names { ft := pp.parseTypeSymbol(method.Type).(*st.FunctionTypeSymbol) toAdd := st.MakeFunction(name.Name, result.Methods(), ft) toAdd.IsInterfaceMethod = true pp.registerIdent(toAdd, name) result.AddMethod(toAdd) } } } return }