def getRef()

in scala-repl/src/main/scala/spark/ztools.sc [607:623]


    def getRef(obj: Any, path: String): String = obj match {
      case null | _: Unit =>
        clearRefIfPathExists(path)
        null
      case ref: AnyRef =>
        val wrapper = new ReferenceWrapper(ref)
        if (refMap.contains(wrapper)) {
          if (refInvMap.get(path).orNull != wrapper) clearRefIfPathExists(path)
          refMap(wrapper)
        } else {
          clearRefIfPathExists(path)
          refMap(wrapper) = path
          refInvMap.put(path, wrapper)
          null
        }
      case _ => null
    }