Ejemplo n.º 1
0
func (pp *packageParser) fixTypesInSymbolTable(table *st.SymbolTable) {
	if table == nil {
		return
	}
	table.ForEachNoLock(func(sym st.Symbol) {

		// 		if sym.Name() == "Parser" {
		// 			fmt.Printf("horay %T\n", sym)
		// 		}

		if uts, ok := sym.(*st.UnresolvedTypeSymbol); ok {

			res := pp.resolveType(uts)
			table.ReplaceSymbol(uts.Name(), res)
			pp.moveData(res, uts)
			// 			fmt.Printf("rewrited %s with %s from %s \n", sym.Name(), res.Name(), res.PackageFrom().AstPackage.Name)
			pp.fixType(res)
		} else {
			//Start recursive walk
			pp.fixType(sym)
		}
	})
}