port convertSymbol and convertRef from old JavaScript toolchain written in Go