nitc :: MExplicitSuper :: _from
nitc :: MExplicitSuper :: defaultinit
nitc :: MExplicitSuper :: from
nitc :: MExplicitSuper :: from=
nitc $ MExplicitSuper :: SELF
Type of this instance, automatically specialized in every classnitc :: MExplicitSuper :: _from
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: NitniCallback :: compile_callback_to_java
Compile C and Java code to implement this callbacknitc :: NitniCallback :: compile_callback_to_objc
Compile this callback to be callable from Objective-Cnitc :: NitniCallback :: defaultinit
nitc :: MExplicitSuper :: defaultinit
core :: Object :: defaultinit
nitc :: MExplicitSuper :: from
nitc :: MExplicitSuper :: from=
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: NitniCallback :: jni_methods_declaration
Returns the list of C functions to link with extern Java methods, as requiredcore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).
redef class MExplicitSuper
private fun compile_extern_callback(v: AbstractCompilerVisitor, ccu: CCompilationUnit, compile_implementation_too: Bool)
do
var mproperty = from.mproperty
assert mproperty isa MMethod
var mclass_type = from.mclassdef.mclass.mclass_type
# In nitni files, declare internal function as extern
var internal_csignature = mproperty.build_csignature(mclass_type, v.compiler.mainmodule, "___super", long_signature, internal_call_context)
ccu.header_decl.add("extern {internal_csignature};\n")
# In nitni files, #define friendly as extern
var friendly_cname = mproperty.build_cname(mclass_type, v.compiler.mainmodule, "___super", short_signature)
var internal_cname = mproperty.build_cname(mclass_type, v.compiler.mainmodule, "___super", long_signature)
ccu.header_decl.add("#define {friendly_cname} {internal_cname}\n")
if not compile_implementation_too then return
# Internally, implement internal function
var nitni_visitor = v.compiler.new_visitor
nitni_visitor.frame = v.frame
var msignature = mproperty.lookup_first_definition(v.compiler.mainmodule, mclass_type).msignature
var csignature_blind = mproperty.build_csignature(mclass_type, v.compiler.mainmodule, "___super", long_signature, internal_call_context)
nitni_visitor.add_decl("/* nitni callback to super for {mproperty.full_name} */")
nitni_visitor.add_decl("{csignature_blind} \{")
var vars = new Array[RuntimeVariable]
var recv_var = nitni_visitor.var_from_c("self", mclass_type)
recv_var = nitni_visitor.box_extern(recv_var, mclass_type)
vars.add(recv_var)
for p in msignature.mparameters do
var arg_mtype = v.anchor(p.mtype)
var arg = nitni_visitor.var_from_c(p.name, arg_mtype)
arg = nitni_visitor.box_extern(arg, arg_mtype)
vars.add(arg)
end
var ret_var = nitni_visitor.supercall(from.as(MMethodDef), mclass_type, vars)
var return_mtype = msignature.return_mtype
if return_mtype != null then
assert ret_var != null
return_mtype = v.anchor(return_mtype)
ret_var = nitni_visitor.autobox(ret_var, return_mtype)
ret_var = nitni_visitor.unbox_extern(ret_var, return_mtype)
nitni_visitor.ret_to_c(ret_var, return_mtype)
end
nitni_visitor.add("\}")
end
end
src/compiler/compiler_ffi/compiler_ffi.nit:199,1--252,3