else if pname == "is_same_type" then
v.ret(v.is_same_type_test(arguments[0], arguments[1]))
return
+ else if pname == "is_same_instance" then
+ v.ret(v.equal_test(arguments[0], arguments[1]))
+ return
else if pname == "output_class_name" then
var nat = v.class_name_string(arguments.first)
v.add("printf(\"%s\\n\", {nat});")
fun is_true: Bool do abort
# Return true if `self` IS `o` (using the Nit semantic of is)
- fun eq_is(o: Instance): Bool do return self is o
+ fun eq_is(o: Instance): Bool do return self.is_same_instance(o)
# Human readable object identity "Type#number"
redef fun to_s do return "{mtype}"
redef fun eq_is(o)
do
if not o isa PrimitiveInstance[Object] then return false
- return self.val is o.val
+ return self.val.is_same_instance(o.val)
end
redef fun to_s do return "{mtype}#{val.object_id}({val})"
return v.bool_instance(args[0] != args[1])
else if pname == "is_same_type" then
return v.bool_instance(args[0].mtype == args[1].mtype)
+ else if pname == "is_same_instance" then
+ return v.bool_instance(args[1] != null and args[0].eq_is(args[1]))
else if pname == "exit" then
exit(args[1].to_i)
abort