end
end
- fun call_closure(closure: ClosureInstance, args: Array[Instance]): nullable Instance
+ # Common code for runtime injected calls and normal calls
+ fun send_commons(mproperty: MMethod, args: Array[Instance], mtype: MType): nullable Instance
do
- var nclosuredef = closure.nclosuredef
- var f = closure.frame
- for i in [0..closure.nclosuredef.mclosure.mtype.as(MSignature).arity[ do
- var variable = nclosuredef.variables[i]
- f.map[variable] = args[i]
- end
-
- self.frames.unshift(f)
-
- self.stmt(nclosuredef.n_expr)
-
- self.frames.shift
-
- if self.is_continue(nclosuredef.escapemark) then
- var res = self.escapevalue
- self.escapevalue = null
- return res
+ if mtype isa MNullType then
+ if mproperty.name == "==" then
+ return self.bool_instance(args[0] == args[1])
+ else if mproperty.name == "!=" then
+ return self.bool_instance(args[0] != args[1])
+ end
- #fatal("Reciever is null. {mproperty}. {args.join(" ")} {self.frame.current_node.class_name}")
- fatal("Reciever is null")
++ #fatal("Receiver is null. {mproperty}. {args.join(" ")} {self.frame.current_node.class_name}")
++ fatal("Receiver is null")
end
return null
end
-alt/error_needed_method_alt2.nit:47,10--27: Error: Method 'init' doesn't exists in Collection[Int].
+alt/error_needed_method_alt2.nit:47,10--27: Cannot instantiate interface Collection[Int].
- alt/error_needed_method_alt2.nit:47,1--40: Type Error: Expected method 'iterator' in type Collection[Int]
+ alt/error_needed_method_alt2.nit:47,1--40: Type Error: 'for' expects a type providing 'iterator' method, got 'Collection[Int]'.