def repl_op_compare(self, op, a, b, val1, val2):
        if op in ['is', 'is_not']:
            return self.substitute("""\
if (${a} === ${b}) {
    return ${val1};
}
if (${a} !== null && ${b} !== null) {
    switch ((${a}.__number__ << 8) | ${b}.__number__) {
        case 0x0101:
            return ${a} == ${b} ? ${val1} : ${val2};
        case 0x0202:
            return $a.__v == $b.__v ? ${val1} : ${val2};
        case 0x0404:
            return @{{long}}['$dict'].__cmp__(${a}, ${b}) == 0 ? ${val1} : ${val2};
    }
}
return ${val2}""" % locals(), locals())

        if op in ['in', 'not_in']:
            return self.substitute("""\
var i, mro$;
${0, getattribute, mro$, i, ${b}, '__contains__'}$
if (typeof i != "undefined") {
${1, bind_method, i, i, ${b}, _meth_src}$
    return @{{fcall}}(this, null, i,  ${b}, ${a}).valueOf() ? ${val1} : ${val2};
}
var __iter__ = @{{iter}}(${b});
var $stopiter = @{{stopiter}}
for (;;) {
    @{{stopiter}} = true;
    i = @{{mcall}}(this, null, __iter__, 'next');
    @{{stopiter}} = $stopiter;
    if (i === @{{StopIter}}) {
        return ${val2};
    }
    if (@{{op_eq}}(i, ${a})) {
        return ${val1};
    }
}
""" % locals(), locals())

        valnull = '${val2}'
        if not '=' in op:
            opis = ''
        elif op == '!=':
            opis = 'if (${a} === ${b}) return ${val2};\n'
            valnull = '${val1}'
        else:
            opis = 'if (${a} === ${b}) return ${val1};\n'
        opis = ''
        return self.substitute("""\
%(opis)sif (${a} !== null && ${b} !== null) {
    switch ((${a}.__number__ << 8) | ${b}.__number__) {
        case 0x0101:
        case 0x0401:
            return ${a}.valueOf() ${op} ${b}.valueOf() ? ${val1} : ${val2};
        case 0x0102:
            return ${a}.valueOf() ${op} ${b}.__v ? ${val1} : ${val2};
        case 0x0201:
            return ${a}.__v ${op} ${b}.valueOf() ? ${val1} : ${val2};
        case 0x0202:
            return ${a}.__v ${op} ${b}.__v ? ${val1} : ${val2};
        case 0x0104:
        case 0x0204:
            ${a} = $new(@{{long}}, ${a}.valueOf());
        case 0x0404:
            if (${a}['__class__'] !== @{{long}}) break;
            return @{{long}}['$dict']['__cmp__'](${a}, ${b}).valueOf() ${op} 0 ? ${val1} : ${val2};
        case 0x0402:
            if (${a}['__class__'] !== @{{long}}) break;
            return @{{long}}['$dict']['__cmp__'](${a}, $new(@{{long}}, ${b}.valueOf())).valueOf() ${op} 0 ? ${val1} : ${val2};
    }
    var v = @{{fcall}}(this, null, @{{cmp}}, null, ${a}, ${b}).valueOf();
    return v === null ? %(valnull)s : (v ${op} 0 ? ${val1} : ${val2});
}
return ${val2};""" % locals(), locals())
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/builtin/mkbuiltin.py/Replacement.repl_op_compare/original