clone_strip_coderef: remove scalar refs

dclone strips code refs and replaces them by a ref to a string, which
encode_json doesn't like. So we now replace those scalar refs with the
scalar itself.