if (!v.isNil()) {
RubyString v_str = v.convertToString();
if (v_str.scanForCodeRange() == StringSupport.CR_BROKEN) {
throw context.runtime.newArgumentError("replacement string is broken: " + v_str);
}
v = v_str.freeze(context);
newhash = RubyHash.newHash(context.runtime);
((RubyHash)newhash).op_aset(context, context.runtime.newSymbol("replace"), v);
}
v = optHash2.op_aref(context, context.runtime.newSymbol("fallback"));