redef fun identify_language(n) do return n.is_c
- redef fun compile_module_block(block, ecc, nmodule)
+ redef fun compile_module_block(block, ecc, mmodule)
do
if block.is_c_header then
ecc.header_custom.add( block.location.as_line_pragma )
end
end
- redef fun compile_extern_method(block, m, ecc, nmodule)
+ redef fun compile_extern_method(block, m, ecc, mmodule)
do
- var fc = new ExternCFunction(m, nmodule.mmodule.as(not null))
+ var fc = new ExternCFunction(m, mmodule.as(not null))
fc.decls.add( block.location.as_line_pragma )
fc.exprs.add( block.code )
ecc.add_exported_function( fc )
end
- redef fun compile_extern_class(block, m, ecc, nmodule) do end
+ redef fun compile_extern_class(block, m, ecc, mmodule) do end
redef fun get_ftype(block, m) do return new ForeignCType(block.code)
- redef fun compile_callback(callback, nmodule, mmodule, ecc)
+ redef fun compile_callback(callback, mmodule, mainmodule, ecc)
do
- callback.compile_callback_to_c(mmodule, ecc)
+ callback.compile_callback_to_c(mainmodule, ecc)
end
end
end
redef class NitniCallback
- fun compile_callback_to_c(nmodule: MModule, ffi_ccu: CCompilationUnit) do end
+ fun compile_callback_to_c(mmodule: MModule, ffi_ccu: CCompilationUnit) do end
end
redef class Object
redef class MModule
# Does this module uses the FFI?
var uses_ffi: Bool = false
-end
-redef class AModule
# C compilation unit for the FFI files
private var ffi_ccu: nullable CCompilationUnit = null
# Foreign language used in this AModule
private var present_languages = new HashSet[FFILanguage]
+ # Complete the compilation of the FFI code
+ fun finalize_ffi_wrapper(compdir: String, mainmodule: MModule)
+ do
+ for language in present_languages do if ffi_callbacks.keys.has(language) then
+ for callback in ffi_callbacks[language] do
+ language.compile_callback(callback, self, mainmodule, ffi_ccu.as(not null))
+ end
+
+ language.compile_to_files(self, compdir)
+ end
+
+ # include dependancies FFI
+ for mod in header_dependencies do
+ if mod.uses_ffi then ffi_ccu.header_custom.add("#include \"{mod.name}._ffi.h\"\n")
+ end
+
+ ffi_ccu.write_as_impl(self, compdir)
+ for filename in ffi_ccu.files do ffi_files.add(new ExternCFile(filename, c_compiler_options))
+ end
+end
+
+redef class AModule
+
# Ensures all of the general foreign code of the module has been analyzed.
# Manages header blocks, extern class types and foreign dependancies between modules
fun ensure_compile_ffi_wrapper
do
- if ffi_ccu != null then return
+ var mmodule = mmodule
+ if mmodule == null or mmodule.ffi_ccu != null then return
# ready extern code compiler
var ffi_ccu = new CCompilationUnit
- self.ffi_ccu = ffi_ccu
+ mmodule.ffi_ccu = ffi_ccu
# generate code
for block in n_extern_code_blocks do
var language = block.language
assert language != null
- present_languages.add(language)
- language.compile_module_block(block, ffi_ccu, self)
+ mmodule.present_languages.add(language)
+ language.compile_module_block(block, ffi_ccu, mmodule)
end
ffi_ccu.header_c_base.add( "#include \"{mmodule.name}._nitni.h\"\n" )
mmodule.uses_ffi = true
var language = nclassdef.n_extern_code_block.language
assert language != null
- present_languages.add(language)
+ mmodule.present_languages.add(language)
nclassdef.n_extern_code_block.language.compile_extern_class(
- nclassdef.n_extern_code_block.as(not null), nclassdef, ffi_ccu, self)
+ nclassdef.n_extern_code_block.as(not null), nclassdef, ffi_ccu, mmodule)
end
end
end
-
- # Complete the compilation of the FFI code
- fun finalize_ffi_wrapper(compdir: String, mainmodule: MModule)
- do
- ensure_compile_ffi_wrapper
-
- for language in present_languages do if ffi_callbacks.keys.has(language) then
- for callback in ffi_callbacks[language] do
- language.compile_callback(callback, self, mainmodule, ffi_ccu.as(not null))
- end
-
- language.compile_to_files(self, compdir)
- end
-
- # include dependancies FFI
- for mod in mmodule.header_dependencies do
- if mod.uses_ffi then ffi_ccu.header_custom.add("#include \"{mod.name}._ffi.h\"\n")
- end
-
- ffi_ccu.write_as_impl(self, compdir)
- for filename in ffi_ccu.files do ffi_files.add(new ExternCFile(filename, mmodule.c_compiler_options))
- end
end
redef class AExternPropdef
private var ffi_has_been_compiled = false
# Compile the necessary wrapper around this extern method or constructor
- fun compile_ffi_method(amodule: AModule)
+ fun compile_ffi_method(mmodule: MModule)
do
assert n_extern_code_block != null
if ffi_has_been_compiled then return
ffi_has_been_compiled = true
- amodule.ensure_compile_ffi_wrapper
-
var language = n_extern_code_block.language
assert language != null
- amodule.present_languages.add(language)
+ mmodule.present_languages.add(language)
n_extern_code_block.language.compile_extern_method(
- n_extern_code_block.as(not null), self, amodule.ffi_ccu.as(not null), amodule)
+ n_extern_code_block.as(not null), self, mmodule.ffi_ccu.as(not null), mmodule)
end
end
# Associate callbacks used by an extern method to its foreign language
for callback in npropdef.foreign_callbacks.all do
- var map = npropdef.parent.parent.as(AModule).ffi_callbacks
+ var map = npropdef.mpropdef.mclassdef.mmodule.ffi_callbacks
if not map.keys.has(lang) then map[lang] = new HashSet[NitniCallback]
map[lang].add(callback)
end
var cpp_language: FFILanguage = new CPPLanguage(self)
end
-redef class AModule
+redef class MModule
private var cpp_file: nullable CPPCompilationUnit = null
-end
-redef class MModule
var cpp_compiler_options writable = ""
end
redef fun identify_language(n) do return n.is_cpp
- redef fun compile_module_block(block, ecc, nmodule)
+ redef fun compile_module_block(block, ecc, mmodule)
do
- if nmodule.cpp_file == null then nmodule.cpp_file = new CPPCompilationUnit
+ if mmodule.cpp_file == null then mmodule.cpp_file = new CPPCompilationUnit
if block.is_cpp_header then
- nmodule.cpp_file.header_custom.add(block.location.as_line_pragma)
- nmodule.cpp_file.header_custom.add(block.code)
+ mmodule.cpp_file.header_custom.add(block.location.as_line_pragma)
+ mmodule.cpp_file.header_custom.add(block.code)
else if block.is_cpp_body then
- nmodule.cpp_file.body_custom.add( block.location.as_line_pragma )
- nmodule.cpp_file.body_custom.add( block.code )
+ mmodule.cpp_file.body_custom.add( block.location.as_line_pragma )
+ mmodule.cpp_file.body_custom.add( block.code )
end
end
# 1. The standard C implementation function (___impl) expected by the common FFI
# 2. The indirection function (___cpp_impl_mid) is a C function, called from C but implemented as `extern "C"` in C++
# 3. The actual C++ implementation function (___cpp_impl)
- redef fun compile_extern_method(block, m, ecc, nmodule)
+ redef fun compile_extern_method(block, m, ecc, mmodule)
do
- if nmodule.cpp_file == null then nmodule.cpp_file = new CPPCompilationUnit
+ if mmodule.cpp_file == null then mmodule.cpp_file = new CPPCompilationUnit
- var mmodule = nmodule.mmodule.as(not null)
var mclass_type = m.parent.as(AClassdef).mclass.mclass_type
var mproperty = m.mpropdef.mproperty
## In C++ file (__ffi.cpp)
# Declare the indirection function in C++
- nmodule.cpp_file.header_decl.add("extern \"C\" \{\n")
- nmodule.cpp_file.header_decl.add("{indirection_sig};\n")
- nmodule.cpp_file.header_decl.add("\}\n")
+ mmodule.cpp_file.header_decl.add("extern \"C\" \{\n")
+ mmodule.cpp_file.header_decl.add("{indirection_sig};\n")
+ mmodule.cpp_file.header_decl.add("\}\n")
# Implement the indirection function as extern in C++
# Will convert C arguments to C++ and call the C++ implementation function.
end
fc.exprs.add(mproperty.build_ccall(mclass_type, mmodule, "___cpp_impl", long_signature, cpp_call_context, "_for_cpp"))
fc.exprs.add("\n")
- nmodule.cpp_file.add_local_function(fc)
+ mmodule.cpp_file.add_local_function(fc)
# Custom C++, the body of the Nit C++ method is copied to its own C++ function
var cpp_signature = mproperty.build_csignature(mclass_type, mmodule, "___cpp_impl", long_signature, cpp_call_context)
fc = new CFunction(cpp_signature)
fc.decls.add( block.location.as_line_pragma )
fc.exprs.add( block.code )
- nmodule.cpp_file.add_local_function( fc )
+ mmodule.cpp_file.add_local_function( fc )
end
- redef fun compile_extern_class(block, m, ecc, nmodule) do end
+ redef fun compile_extern_class(block, m, ecc, mmodule) do end
redef fun get_ftype(block, m) do return new ForeignCppType(block.code)
- redef fun compile_to_files(nmodule, compdir)
+ redef fun compile_to_files(mmodule, compdir)
do
- var cpp_file = nmodule.cpp_file
+ var cpp_file = mmodule.cpp_file
assert cpp_file != null
# write .cpp and .hpp file
cpp_file.header_custom.add("extern \"C\" \{\n")
- cpp_file.header_custom.add("#include \"{nmodule.mmodule.name}._ffi.h\"\n")
+ cpp_file.header_custom.add("#include \"{mmodule.name}._ffi.h\"\n")
cpp_file.header_custom.add("\}\n")
- var file = cpp_file.write_to_files(nmodule, compdir)
+ var file = cpp_file.write_to_files(mmodule, compdir)
# add complation to makefile
- nmodule.ffi_files.add(file)
+ mmodule.ffi_files.add(file)
# add linked option to support C++
- nmodule.mmodule.c_linker_options = "{nmodule.mmodule.c_linker_options} -lstdc++"
+ mmodule.c_linker_options = "{mmodule.c_linker_options} -lstdc++"
end
- redef fun compile_callback(callback, nmodule, mmodule, ecc)
+ redef fun compile_callback(callback, mmodule, mainmodule, ecc)
do
- callback.compile_callback_to_cpp(nmodule, mmodule)
+ callback.compile_callback_to_cpp(mmodule, mainmodule)
end
end
class CPPCompilationUnit
super CCompilationUnit
- fun write_to_files(amodule: AModule, compdir: String): ExternCppFile
+ fun write_to_files(mmodule: MModule, compdir: String): ExternCppFile
do
- var mmodule = amodule.mmodule.as(not null)
var base_name = "{mmodule.name}._ffi"
var h_file = "{base_name}.hpp"
- var guard = "{amodule.cname.to_s.to_upper}_NIT_HPP"
+ var guard = "{mmodule.cname.to_s.to_upper}_NIT_HPP"
- write_header_to_file(amodule, "{compdir}/{h_file}", new Array[String], guard)
+ write_header_to_file(mmodule, "{compdir}/{h_file}", new Array[String], guard)
var c_file = "{base_name}.cpp"
- write_body_to_file(amodule, "{compdir}/{c_file}", ["<string>", "<iostream>", "\"{h_file}\""])
+ write_body_to_file(mmodule, "{compdir}/{c_file}", ["<string>", "<iostream>", "\"{h_file}\""])
files.add("{compdir}/{c_file}")
end
redef class NitniCallback
- fun compile_callback_to_cpp(nmodule: AModule, mmodule: MModule) do end
+ fun compile_callback_to_cpp(mmodule: MModule, mainmodule: MModule) do end
end
redef class Object
end
redef class MExplicitCall
- redef fun compile_callback_to_cpp(nmodule, mmodule)
+ redef fun compile_callback_to_cpp(mmodule, mainmodule)
do
var mproperty = mproperty
assert mproperty isa MMethod
- var cpp_signature = mproperty.build_csignature(recv_mtype, mmodule, null, short_signature, from_cpp_call_context)
- var ccall = mproperty.build_ccall(recv_mtype, mmodule, null, long_signature, from_cpp_call_context, null)
+ var cpp_signature = mproperty.build_csignature(recv_mtype, mainmodule, null, short_signature, from_cpp_call_context)
+ var ccall = mproperty.build_ccall(recv_mtype, mainmodule, null, long_signature, from_cpp_call_context, null)
var fc = new CFunction(cpp_signature)
fc.exprs.add(ccall)
- nmodule.cpp_file.add_local_function( fc )
+ mmodule.cpp_file.add_local_function( fc )
end
end
end
end
-redef class AModule
+redef class MModule
var ffi_files = new Array[ExternFile]
# Callbacks used by this module, classified by language
fun identify_language(block: AExternCodeBlock ): Bool is abstract
# Generate wrapper code for this module/header code block
- fun compile_module_block(block: AExternCodeBlock, ecc: CCompilationUnit, nmodule: AModule) is abstract
+ fun compile_module_block(block: AExternCodeBlock, ecc: CCompilationUnit, mmodule: MModule) is abstract
# Generate wrapper code for this extern method
fun compile_extern_method(block: AExternCodeBlock, m: AExternPropdef,
- ecc: CCompilationUnit, nmodule: AModule) is abstract
+ ecc: CCompilationUnit, mmodule: MModule) is abstract
# Generate wrapper code for this extern class
fun compile_extern_class(block: AExternCodeBlock, m: AClassdef,
- ecc: CCompilationUnit, nmodule: AModule) is abstract
+ ecc: CCompilationUnit, mmodule: MModule) is abstract
# Get the foreign type of this extern class definition
fun get_ftype(block: AExternCodeBlock, m: AClassdef): ForeignType is abstract
# Generate the code to offer this callback if foreign code
- fun compile_callback(callback: NitniCallback, nmodule: AModule,
+ fun compile_callback(callback: NitniCallback, mmodule: MModule,
mainmmodule: MModule, ecc: CCompilationUnit) is abstract
# Complete compilation of generated code
- fun compile_to_files(amodule: AModule, directory: String) do end
+ fun compile_to_files(mmodule: MModule, directory: String) do end
end
redef class TString
end
redef class CCompilationUnit
- fun write_as_impl( amodule: AModule, compdir: String )
+ fun write_as_impl(mmodule: MModule, compdir: String)
do
- var base_name = "{amodule.mmodule.name}._ffi"
+ var base_name = "{mmodule.name}._ffi"
var h_file = "{base_name}.h"
- var guard = "{amodule.cname.to_s.to_upper}_NIT_H"
- write_header_to_file( amodule, "{compdir}/{h_file}", new Array[String], guard)
+ var guard = "{mmodule.cname.to_s.to_upper}_NIT_H"
+ write_header_to_file(mmodule, "{compdir}/{h_file}", new Array[String], guard)
var c_file = "{base_name}.c"
- write_body_to_file( amodule, "{compdir}/{c_file}", ["<stdlib.h>", "<stdio.h>", "\"{h_file}\""] )
+ write_body_to_file(mmodule, "{compdir}/{c_file}", ["<stdlib.h>", "<stdio.h>", "\"{h_file}\""])
files.add( "{compdir}/{c_file}" )
end
- fun write_header_to_file(amodule: AModule, file: String, includes: Array[String], guard: String)
+ fun write_header_to_file(mmodule: MModule, file: String, includes: Array[String], guard: String)
do
var stream = new OFStream.open( file )
# header comments
- var module_info = "/*\n\tExtern implementation of Nit module {amodule.mmodule.name}\n*/\n"
+ var module_info = "/*\n\tExtern implementation of Nit module {mmodule.name}\n*/\n"
stream.write( module_info )
stream.close
end
- fun write_body_to_file(amodule: AModule, file: String, includes: Array[String])
+ fun write_body_to_file(mmodule: MModule, file: String, includes: Array[String])
do
var stream = new OFStream.open(file)
- var module_info = "/*\n\tExtern implementation of Nit module {amodule.mmodule.name}\n*/\n"
+ var module_info = "/*\n\tExtern implementation of Nit module {mmodule.name}\n*/\n"
stream.write( module_info )
for incl in includes do stream.write( "#include {incl}\n" )
redef fun identify_language(n) do return n.is_java
- redef fun compile_module_block(block, ccu, nmodule)
+ redef fun compile_module_block(block, ccu, mmodule)
do
- nmodule.ensure_java_files
- var java_file = nmodule.java_file
+ mmodule.ensure_java_files
+ var java_file = mmodule.java_file
assert java_file != null
java_file.header.add(block.code)
end
- redef fun compile_extern_method(block, m, ccu, nmodule)
+ redef fun compile_extern_method(block, m, ccu, mmodule)
do
ffi_ccu = ccu
- nmodule.ensure_java_files
- var java_file = nmodule.java_file
+ mmodule.ensure_java_files
+ var java_file = mmodule.java_file
assert java_file != null
- var mmodule = nmodule.mmodule.as(not null)
var mclass_type = m.parent.as(AClassdef).mclass.mclass_type
var mmethodef = m.mpropdef
var mproperty = m.mpropdef.mproperty
# Java implementation function in Java
var java_csig = mproperty.build_csignature(mclass_type, mmodule, "___java_impl", long_signature, java_call_context)
- nmodule.java_file.class_content.add """
+ mmodule.java_file.class_content.add """
public static {{{java_csig}}} {
// from Nit FII at: {{{block.location}}}
{{{block.code}}}
"""
end
- redef fun compile_extern_class(block, m, ccu, nmodule) do end
+ redef fun compile_extern_class(block, m, ccu, mmodule) do end
redef fun get_ftype(block, m) do return new ForeignJavaType(block.code)
- redef fun compile_to_files(nmodule, compdir)
+ redef fun compile_to_files(mmodule, compdir)
do
# Make sure we have a .java file
- nmodule.ensure_java_files
+ mmodule.ensure_java_files
# Needed compiler and linker options
- nmodule.insert_compiler_options
+ mmodule.insert_compiler_options
# Enable linking C callbacks to java native methods
- nmodule.ensure_linking_callback_methods(ffi_ccu, nmodule.ffi_callbacks[self])
+ mmodule.ensure_linking_callback_methods(ffi_ccu, mmodule.ffi_callbacks[self])
# Java implementation code
- var java_file = nmodule.java_file
+ var java_file = mmodule.java_file
assert java_file != null
var extern_java_file = java_file.write_to_files(compdir)
- nmodule.ffi_files.add(extern_java_file)
+ mmodule.ffi_files.add(extern_java_file)
end
var ffi_ccu: CCompilationUnit # HACK
- redef fun compile_callback(callback, nmodule, mainmodule, ccu)
+ redef fun compile_callback(callback, mmodule, mainmodule, ccu)
do
ffi_ccu = ccu
- callback.compile_callback_to_java(nmodule, ccu)
+ callback.compile_callback_to_java(mmodule, ccu)
end
end
-redef class AModule
+redef class MModule
# Pure java class source file
private var java_file: nullable JavaClassTemplate = null
if java_file != null then return
# Java implementation code
- java_file = new JavaClassTemplate(mmodule.impl_java_class_name)
+ java_file = new JavaClassTemplate(impl_java_class_name)
end
# Compile C code to call JNI and link C callbacks implementations to Java extern methods
var jni_methods = new Array[String]
for cb in callbacks do
- jni_methods.add_all(cb.jni_methods_declaration(mmodule.as(not null)))
+ jni_methods.add_all(cb.jni_methods_declaration(self))
end
var cf = new CFunction("static void nit_ffi_with_java_register_natives(JNIEnv* env, jclass jclazz)")
# Tell the C compiler where to find jni.h and how to link with libjvm
private fun insert_compiler_options
do
- mmodule.c_compiler_options = "{mmodule.c_compiler_options} -I $(JAVA_HOME)/include/"
- mmodule.c_linker_options = "{mmodule.c_linker_options} -L $(JNI_LIB_PATH) -ljvm"
+ c_compiler_options = "{c_compiler_options} -I $(JAVA_HOME)/include/"
+ c_linker_options = "{c_linker_options} -L $(JNI_LIB_PATH) -ljvm"
end
-end
-redef class MModule
# Name of the generated Java class where to store all implementation methods of this module
# as well as generated callbacks.
private fun impl_java_class_name: String do return "Nit_{name}"
redef class NitniCallback
# Compile C and Java code to implement this callback
- fun compile_callback_to_java(nmodule: AModule, ccu: CCompilationUnit) do end
+ fun compile_callback_to_java(mmodule: MModule, ccu: CCompilationUnit) do end
# Returns the list of C functions to link with extern Java methods, as required
# to enable this callback from Java code.
#
- # Return used by `AModule::ensure_linking_callback_methods`
+ # Return used by `MModule::ensure_linking_callback_methods`
#
# TODO we return an Array to support cast and other features like that
fun jni_methods_declaration(from_module: MModule): Array[String] do return new Array[String]
end
redef class MExplicitCall
- redef fun compile_callback_to_java(nmodule, ccu)
+ redef fun compile_callback_to_java(mmodule, ccu)
do
var mproperty = mproperty
assert mproperty isa MMethod
- var mmodule = nmodule.mmodule.as(not null)
# In C, indirection implementing the Java extern methods
var csignature = mproperty.build_c_implementation_signature(recv_mtype, mmodule, "___indirect", long_signature, from_java_call_context)
# In Java, declare the extern method as a private static local method
var java_signature = mproperty.build_csignature(recv_mtype, mmodule, null, short_signature, java_call_context)
- nmodule.java_file.class_content.add "private native static {java_signature};\n"
+ mmodule.java_file.class_content.add "private native static {java_signature};\n"
end
redef fun jni_methods_declaration(from_mmodule)
var v = compiler.new_visitor
var n = nmodule(v)
if n == null then return
- n.finalize_ffi_wrapper(v.compiler.modelbuilder.compile_dir, v.compiler.mainmodule)
- for file in n.ffi_files do v.compiler.extern_bodies.add(file)
+ n.ensure_compile_ffi_wrapper
+ finalize_ffi_wrapper(v.compiler.modelbuilder.compile_dir, v.compiler.mainmodule)
+ for file in ffi_files do v.compiler.extern_bodies.add(file)
ensure_compile_nitni_base(v)
nitni_ccu.header_c_types.add("#include \"{name}._ffi.h\"\n")
- nitni_ccu.write_as_nitni(n, v.compiler.modelbuilder.compile_dir)
+ nitni_ccu.write_as_nitni(self, v.compiler.modelbuilder.compile_dir)
for file in nitni_ccu.files do
v.compiler.extern_bodies.add(new ExternCFile(file, c_compiler_options))
v.declare_once("{csignature};")
# FFI part
- compile_ffi_method(amodule)
+ amodule.ensure_compile_ffi_wrapper
+ compile_ffi_method(mmodule)
# nitni - Compile missing callbacks
mmodule.ensure_compile_nitni_base(v)
redef fun compile_to_c(v, mpropdef, arguments)
do
var mmodule = mpropdef.mclassdef.mmodule
- var amodule = v.compiler.modelbuilder.mmodule2nmodule[mmodule]
# if using the old native interface fallback on previous implementation
var nextern = self.n_extern
return
end
- amodule.mmodule.uses_ffi = true
+ mmodule.uses_ffi = true
var mclass_type = mpropdef.mclassdef.bound_mtype
redef fun compile_to_c(v, mpropdef, arguments)
do
var mmodule = mpropdef.mclassdef.mmodule
- var amodule = v.compiler.modelbuilder.mmodule2nmodule[mmodule]
# if using the old native interface fallback on previous implementation
var nextern = self.n_extern
return
end
- amodule.mmodule.uses_ffi = true
+ mmodule.uses_ffi = true
var mclass_type = mpropdef.mclassdef.bound_mtype
end
redef class CCompilationUnit
- fun write_as_nitni(amodule: AModule, compdir: String)
+ fun write_as_nitni(mmodule: MModule, compdir: String)
do
- var base_name = "{amodule.mmodule.name}._nitni"
+ var base_name = "{mmodule.name}._nitni"
var h_file = "{base_name}.h"
- write_header_to_file( amodule, "{compdir}/{h_file}", new Array[String],
- "{amodule.cname.to_s.to_upper}_NITG_NITNI_H")
+ write_header_to_file( mmodule, "{compdir}/{h_file}", new Array[String],
+ "{mmodule.cname.to_s.to_upper}_NITG_NITNI_H")
var c_file = "{base_name}.c"
- write_body_to_file( amodule, "{compdir}/{c_file}", ["\"{h_file}\""] )
+ write_body_to_file( mmodule, "{compdir}/{c_file}", ["\"{h_file}\""] )
files.add( "{compdir}/{c_file}" )
end
end
end
-redef class AModule
+redef class MModule
# Mangled name of this module in C
- fun cname: String do return mmodule.name
+ fun cname: String do return name
end
redef class MMethodDef