Add friendly message to Chk for Reffer != nil

Now you get told you're holding it wrong when you fail
to import the enc package and get the global definition for
Reffer.
This commit is contained in:
Chris Masone
2015-07-08 15:53:10 -07:00
parent 4b4a1b1f47
commit cd9656cdb9

View File

@@ -9,7 +9,7 @@ type cachedRef ref.Ref
func (cr *cachedRef) Ref(v Value) ref.Ref {
if ref.Ref(*cr) == (ref.Ref{}) {
Chk.NotNil(Reffer)
Chk.NotNil(Reffer, "Reffer is nil; you probably need to import 'enc'.")
*cr = cachedRef(Reffer(v))
}
return ref.Ref(*cr)