src: rename 'module' identifiers
authorJean Privat <jean@pryen.org>
Thu, 20 Jan 2011 16:56:43 +0000 (11:56 -0500)
committerJean Privat <jean@pryen.org>
Thu, 20 Jan 2011 16:56:43 +0000 (11:56 -0500)
'module' will become a keyword.
Therefore the identifiers 'module' must be renamed.

The strategy is the following:
* use 'mod' in local variables and parameters
* Program::module -> Program::main_module
* use mmmodule for other properties (no better ideas)

Signed-off-by: Jean Privat <jean@pryen.org>

30 files changed:
src/analysis/cha_analysis.nit
src/analysis/dead_method_removal.nit
src/analysis/instantiated_type_analysis.nit
src/analysis/reachable_as_init.nit
src/analysis/reachable_as_init_impl.nit
src/analysis/reachable_from_init_method_analysis.nit
src/analysis/reachable_from_init_method_analysis_impl.nit
src/analysis/reachable_method_analysis.nit
src/analysis/remove_out_of_init_get_test.nit
src/analysis/rta_analysis.nit
src/compiling/compiling.nit
src/compiling/compiling_base.nit
src/compiling/compiling_global.nit
src/compiling/compiling_icode.nit
src/compiling/table_computation.nit
src/icode/icode_builder.nit
src/metamodel/abstractmetamodel.nit
src/metamodel/genericity.nit
src/metamodel/inheritance.nit
src/metamodel/static_type.nit
src/metamodel/virtualtype.nit
src/mmloader.nit
src/nitdoc.nit
src/primitive_info.nit
src/program.nit
src/syntax/icode_generation.nit
src/syntax/mmbuilder.nit
src/syntax/syntax.nit
src/syntax/syntax_base.nit
src/syntax/typing.nit

index ed2a120..ba68c2b 100644 (file)
@@ -99,7 +99,7 @@ special ICodeVisitor
                else if ic isa INew then
                        # FIXME: take only the last property on the redef. hierarchie
                        var t = ic.stype
-                       var cls = t.for_module(builder.program.module).local_class
+                       var cls = t.for_module(builder.program.main_module).local_class
                        var m = cls[ic.property.global].as(MMMethod)
                        var r = cls.new_instance_iroutine[m]
                        builder.add_search(ic.property, r, false, false)
@@ -109,12 +109,12 @@ special ICodeVisitor
                        builder.add_search(ic.property, ic.property.iroutine, false, false)
                else if ic isa ICheckInstance then
                        var t = ic.stype
-                       var cls = t.for_module(builder.program.module).local_class
+                       var cls = t.for_module(builder.program.main_module).local_class
                        var ir = cls.checknew_iroutine
                        builder.add_search(null, ir, true, false)
                else if ic isa IInitAttributes then
                        var t = ic.stype
-                       var cls = t.for_module(builder.program.module).local_class
+                       var cls = t.for_module(builder.program.main_module).local_class
                        var ir = cls.init_var_iroutine
                        builder.add_search(null, ir, true, false)
                end
index 703a72b..8e9c18b 100644 (file)
@@ -38,7 +38,7 @@ redef class Program
 
        # This method will create a file and output informations about this optimization
        fun dump_dead_method_optimization(directory_name: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.dmr_opt.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.dmr_opt.log")
 
                f.write("Nb. dead iroutines removed: {nb_removed_iroutines}\n")
                f.write("Nb. live iroutines: {nb_not_removed_iroutines}\n")
index 3650f44..58af9d4 100644 (file)
@@ -25,7 +25,7 @@ redef class Program
 
        # This method will create a file and output the name of all types that are instantiated in it
        fun dump_instantiated_types(directory_name: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.instantiated_types.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.instantiated_types.log")
                with_each_live_local_classes !action(c) do
                        f.write("{c}\n")
                end
@@ -34,9 +34,9 @@ redef class Program
 
        # This method will create a file and output the names of all types that are not instantiated in it
        fun dump_not_instantiated_types(directory_name: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.not_instantiated_types.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.not_instantiated_types.log")
                # Must overwrite 'with_each_local_classes' since we are looking at non-instantiated classes
-               for c in module.local_classes do
+               for c in main_module.local_classes do
                        if not ita.is_class_instantiated(c) then
                                f.write("{c}\n")
                        end
@@ -48,7 +48,7 @@ redef class Program
        redef fun with_each_live_local_classes
                !action(m: MMLocalClass)
        do
-               for c in module.local_classes do
+               for c in main_module.local_classes do
                        if ita == null or ita.as(not null).is_class_instantiated(c) then action(c)
                end
        end
index fa81128..0d9fb88 100644 (file)
@@ -26,7 +26,7 @@ redef class Program
 
        # This method will create a file and output all inits reachable as init in it
        fun dump_reachable_as_init_methods(directory_name: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.reachable_methods_as_init.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.reachable_methods_as_init.log")
                with_each_live_local_classes !action(c) do
                        for g in c.global_properties do
                                var p = c[g]
index a3b3677..3aaa15a 100644 (file)
@@ -61,7 +61,7 @@ special ICodeVisitor
                if ic isa INew then
                        # FIXME: take only the last property on the redef. hierarchie
                        var t = ic.stype
-                       var cls = t.for_module(builder.program.module).local_class
+                       var cls = t.for_module(builder.program.main_module).local_class
                        var m = cls[ic.property.global].as(MMMethod)
                        assert m.global.is_init
                        if not builder.context._methods.has_key(cls) then builder.context._methods[cls] = new List[MMMethod]
index 9c0f78c..4397066 100644 (file)
@@ -28,7 +28,7 @@ redef class Program
        # This method will create a file and output the name of all methods reachable
        # from an init in it
        fun dump_reachable_methods_from_init(directory_name: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.reachable_methods_from_init.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.reachable_methods_from_init.log")
                with_each_methods !action(m) do
                        if rfima.is_method_reachable_from_init(m) then
                                f.write("{m.full_name}\n")
@@ -40,7 +40,7 @@ redef class Program
        # This method will create a file and output the name of all reachable methods that
        # can not be reached from an init in it
        fun dump_unreachable_methods_from_init(directory_name: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.unreachable_methods_from_init.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.unreachable_methods_from_init.log")
                with_each_methods !action(m) do
                        if not rfima.is_method_reachable_from_init(m) and rma.is_method_reachable(m) then
                                f.write("{m.full_name}\n")
index 220ebd9..ad04ed1 100644 (file)
@@ -86,7 +86,7 @@ special ICodeVisitor
                else if ic isa INew then
                        # FIXME: take only the last property on the redef. hierarchie
                        var t = ic.stype
-                       var cls = t.for_module(program.module).local_class
+                       var cls = t.for_module(program.main_module).local_class
                        var m = cls[ic.property.global].as(MMMethod)
                        var r = cls.new_instance_iroutine[m]
                        process_call(r)
@@ -112,12 +112,12 @@ special ICodeVisitor
                        end
                else if ic isa ICheckInstance then
                        var t = ic.stype
-                       var cls = t.for_module(program.module).local_class
+                       var cls = t.for_module(program.main_module).local_class
                        var ir = cls.checknew_iroutine
                        if ir != null then process_call(ir)
                else if ic isa IInitAttributes then
                        var t = ic.stype
-                       var cls = t.for_module(program.module).local_class
+                       var cls = t.for_module(program.main_module).local_class
                        var ir = cls.init_var_iroutine
                        if ir != null then process_call(ir)
                end
index c1c37d9..ef2b4fe 100644 (file)
@@ -26,7 +26,7 @@ redef class Program
 
        # This method will create a file and output all reachable method names in it
        fun dump_reachable_methods(directory_name: String, algo: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.reachable_methods.{algo}.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.reachable_methods.{algo}.log")
                with_each_methods !action(m) do
                        if rma.is_method_reachable(m) then
                                f.write("{m.full_name}\n")
@@ -37,7 +37,7 @@ redef class Program
 
        # This method will create a file and output all unreachable method names in it
        fun dump_unreachable_methods(directory_name: String, algo: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.unreachable_methods.{algo}.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.unreachable_methods.{algo}.log")
                with_each_methods !action(m) do
                        if not rma.is_method_reachable(m) then
                                f.write("{m.full_name}\n")
index 2dc1c8c..8db2cb4 100644 (file)
@@ -38,7 +38,7 @@ redef class Program
 
        # This method will create a file and output informations about this optimization
        fun dump_out_of_init_information(directory_name: String) do
-               var f = new OFStream.open("{directory_name}/{module.name}.out_of_init_opt.log")
+               var f = new OFStream.open("{directory_name}/{main_module.name}.out_of_init_opt.log")
                var nb_not_optimized = 0
 
                with_each_iroutines !action(i,m) do
index 0fd4165..a10dcac 100644 (file)
@@ -57,7 +57,7 @@ class RtaBuilder
        # Also check every subclasses if they use the same 'version' of the
        # method
        fun check_method(m: MMMethod): Bool do
-               var m_cls = m.local_class.for_module(program.module)
+               var m_cls = m.local_class.for_module(program.main_module)
 
                if context.is_class_instantiated(m_cls) then return true
 
@@ -139,13 +139,13 @@ class RtaBuilder
                var forced_types = ["Object", "Bool", "Float", "Int", "String", "NativeString", "Range", "Array", "ArrayIterator", "Inline__"]
 
                for some_type in forced_types do
-                       if not program.module.has_global_class_named(some_type.to_symbol) then continue
-                       var cls_type = program.module.class_by_name(some_type.to_symbol)
+                       if not program.main_module.has_global_class_named(some_type.to_symbol) then continue
+                       var cls_type = program.main_module.class_by_name(some_type.to_symbol)
                        add_instantiated_class(cls_type)
                end
 
-               if program.module.has_global_class_named("Inline__".to_symbol) then
-                       var ptr_class = program.module.class_by_name("Inline__".to_symbol)
+               if program.main_module.has_global_class_named("Inline__".to_symbol) then
+                       var ptr_class = program.main_module.class_by_name("Inline__".to_symbol)
                        # Assume that all classes that are subclasses of Inline__
                        # can be inlined without notice ...
                        # and are always counted as instantiated
@@ -154,8 +154,8 @@ class RtaBuilder
                        end
                end
 
-               if program.module.has_global_class_named("Pointer".to_symbol) then
-                       var ptr_class = program.module.class_by_name("Pointer".to_symbol)
+               if program.main_module.has_global_class_named("Pointer".to_symbol) then
+                       var ptr_class = program.main_module.class_by_name("Pointer".to_symbol)
                        # Assume that all classes that are subclasses of Pointer
                        # can be returned by the native interface
                        # and are always counted as instantiated
@@ -164,9 +164,9 @@ class RtaBuilder
                        end
                end
 
-               for cls in program.module.global_classes do
+               for cls in program.main_module.global_classes do
                        if not cls.is_universal then continue
-                       add_instantiated_class(program.module[cls])
+                       add_instantiated_class(program.main_module[cls])
                end
        end
 
@@ -175,8 +175,8 @@ class RtaBuilder
                if program.main_method == null then
                        # Add primitive type (so that compiling works)
                        for t in ["Int","Char","Bool"] do
-                               if program.module.has_global_class_named(t.to_symbol) then
-                                       add_instantiated_class(program.module.class_by_name(t.to_symbol))
+                               if program.main_module.has_global_class_named(t.to_symbol) then
+                                       add_instantiated_class(program.main_module.class_by_name(t.to_symbol))
                                end
                        end
                        return
@@ -206,7 +206,7 @@ special ICodeVisitor
                else if ic isa INew then
                        # FIXME: take only the last property on the redef. hierarchie
                        var t = ic.stype
-                       var cls = t.for_module(builder.program.module).local_class
+                       var cls = t.for_module(builder.program.main_module).local_class
                        var m = cls[ic.property.global].as(MMMethod)
                        var r = cls.new_instance_iroutine[m]
                        builder.add_instantiated_class(cls)
@@ -222,12 +222,12 @@ special ICodeVisitor
                        builder.add_reachable_call(ic)
                else if ic isa ICheckInstance then
                        var t = ic.stype
-                       var cls = t.for_module(builder.program.module).local_class
+                       var cls = t.for_module(builder.program.main_module).local_class
                        var ir = cls.checknew_iroutine
                        builder.add_reachable_iroutine(ir)
                else if ic isa IInitAttributes then
                        var t = ic.stype
-                       var cls = t.for_module(builder.program.module).local_class
+                       var cls = t.for_module(builder.program.main_module).local_class
                        var ir = cls.init_var_iroutine
                        builder.add_reachable_iroutine(ir)
                end
index 0099b6b..8dcadba 100644 (file)
@@ -58,7 +58,7 @@ redef class Program
                cprogram.files.add("$CLIBDIR/gc_static_objects_list.c")
 
                tc.info("Generating C code",1)
-               for m in module.mhe.greaters_and_self do m.compile_separate_module(cprogram)
+               for m in main_module.mhe.greaters_and_self do m.compile_separate_module(cprogram)
 
                tc.info("Generating main, tables and makefile ...",1)
                compile_main(cprogram)
@@ -71,15 +71,15 @@ redef class Program
        # Compile the main file
        private fun compile_main(cprogram: CProgram)
        do
-               var v = new CompilerVisitor(module, cprogram)
+               var v = new CompilerVisitor(main_module, cprogram)
                v.add_decl("#include <nit_common.h>")
                compile_tables_to_c(v)
                compile_main_part(v)
-               var filename = "{cprogram.compdir}/{module.name}._tables.c"
+               var filename = "{cprogram.compdir}/{main_module.name}._tables.c"
                cprogram.files.add(filename)
                var f = new OFStream.open(filename)
-               f.write("/* This C file is generated by NIT to compile program {module.name}. */\n")
-               for m in module.mhe.greaters_and_self do
+               f.write("/* This C file is generated by NIT to compile program {main_module.name}. */\n")
+               for m in main_module.mhe.greaters_and_self do
                        f.write("#include \"{cprogram.module_header_name(m)}\"\n")
                end
                v.header_writer.write_to_stream(f)
index e1c5040..38c0ecd 100644 (file)
@@ -43,7 +43,7 @@ class CProgram
        do
                _program = p
                _compdir = p.tc.compdir.as(not null)
-               _build_file = "{compdir}/{program.module.name}._build.sh"
+               _build_file = "{compdir}/{program.main_module.name}._build.sh"
        end
 
        # The Nit program compiled to C
@@ -92,15 +92,15 @@ class CProgram
                end
 
                f.write("#!/bin/sh\n")
-               f.write("# This shell script is generated by NIT to compile the program {program.module.name}.\n")
+               f.write("# This shell script is generated by NIT to compile the program {program.main_module.name}.\n")
                f.write("CLIBDIR=\"{tc.clibdir.as(not null)}\"\n")
                f.write("{tc.bindir.as(not null)}/gccx {verbose} -d {compdir} -I $CLIBDIR {include_dirs.join(" ")}")
                if tc.output_file != null then
                        f.write(" -o {tc.output_file.as(not null)}")
                else if tc.ext_prefix.is_empty then
-                       f.write(" -o {program.module.name}")
+                       f.write(" -o {program.main_module.name}")
                else
-                       f.write(" -o {program.module.name}_{tc.ext_prefix}")
+                       f.write(" -o {program.main_module.name}_{tc.ext_prefix}")
                end
                if tc.boost then f.write(" -O")
                if not tc.cc_link then f.write(" -x \"-c\"")
@@ -188,8 +188,8 @@ class CompilerVisitor
                if _indent_level < 0 then _indent_level = 0
        end
 
-       # The processed module
-       readable var _module: MMModule
+       # The processed mmmodule
+       readable var _mmmodule: MMModule
 
        # Where header decl are stored (public stuff)
        readable writable var _header_writer: Writer
@@ -216,9 +216,9 @@ class CompilerVisitor
        readable var _cprogram: CProgram
 
        # Create a new CompilerVisitor based on a module
-       init(module: MMModule, cp: CProgram)
+       init(mod: MMModule, cp: CProgram)
        do
-               _module = module
+               _mmmodule = mod
                _cprogram = cp
                _program = cp.program
 
@@ -275,7 +275,7 @@ redef class MMLocalProperty
        do
                var cname = _cname_cache
                if cname == null then
-                       cname = cmangle(module.name, local_class.name, name)
+                       cname = cmangle(mmmodule.name, local_class.name, name)
                        _cname_cache = cname
                end
                return cname
index 9787d8a..fee98ea 100644 (file)
@@ -24,7 +24,7 @@ redef class Program
        # Compile module and class tables
        fun compile_tables_to_c(v: CompilerVisitor)
        do
-               for m in module.mhe.greaters_and_self do
+               for m in main_module.mhe.greaters_and_self do
                        m.compile_local_table_to_c(v)
                end
 
@@ -34,7 +34,7 @@ redef class Program
 
                var s = new Buffer.from("classtable_t TAG2VFT[4] = \{NULL")
                for t in ["Int","Char","Bool"] do
-                       if module.has_global_class_named(t.to_symbol) then
+                       if main_module.has_global_class_named(t.to_symbol) then
                                s.append(", (const classtable_t)VFT_{t}")
                        else
                                s.append(", NULL")
@@ -69,7 +69,7 @@ redef class MMModule
        fun declare_class_tables_to_c(v: CompilerVisitor)
        do
                for c in local_classes do
-                       if c.global.module == self then
+                       if c.global.mmmodule == self then
                                c.declare_tables_to_c(v)
                        end
                end
index 9b14dec..09eb1bb 100644 (file)
@@ -289,7 +289,7 @@ redef class IRoutine
                        v.add_decl("struct \{struct stack_frame_t me;\} fra;")
                end
                v.add_instr("fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;")
-               v.add_instr("fra.me.file = LOCATE_{v.visitor.module.name};")
+               v.add_instr("fra.me.file = LOCATE_{v.visitor.mmmodule.name};")
                v.add_instr("fra.me.line = {ll};")
                v.add_instr("fra.me.meth = LOCATE_{v.basecname};")
                v.add_instr("fra.me.has_broke = 0;")
index 9a8a423..df7dc3b 100644 (file)
@@ -143,7 +143,7 @@ redef class Program
        fun do_table_computation
        do
                tc.info("Building tables",1)
-               for m in module.mhe.greaters_and_self do
+               for m in main_module.mhe.greaters_and_self do
                        tc.info("Building tables for module: {m.name}",2)
                        m.local_analysis
                end
@@ -170,7 +170,7 @@ redef class Program
 
                # We have to work on ALL the classes of the module
                var classes = new Array[MMLocalClass]
-               for c in module.local_classes do classes.add(c)
+               for c in main_module.local_classes do classes.add(c)
                classes.sort !cmp(x,y) = x.total_order_compare(y)
 
                for c in classes do
@@ -181,7 +181,7 @@ redef class Program
                        # Assign a unique class identifier
                        # (negative are for primitive classes)
                        var gc = c.global
-                       var bm = gc.module
+                       var bm = gc.mmmodule
                        if c.primitive_info != null then
                                cc.id = pclassid
                                pclassid = pclassid - 4
@@ -480,7 +480,7 @@ special TableElt
 special AbsTableEltClass
        redef fun is_related_to(c)
        do
-               var bc = c.module[_local_class.global]
+               var bc = c.mmmodule[_local_class.global]
                return c.cshe <= bc
        end
 end
index d6691d3..d5c9753 100644 (file)
@@ -49,7 +49,7 @@ class ICodeBuilder
        fun add_null_reciever_check(e: IRegister)
        do
                var nul = lit_null_reg
-               var c = expr(new IIs(e, nul), module.type_bool)
+               var c = expr(new IIs(e, nul), mmmodule.type_bool)
                var iif = new IIf(c)
                stmt(iif)
                var old_seq = seq
@@ -61,7 +61,7 @@ class ICodeBuilder
        # Add a type cast (ITypeCheck + IAbort) in the current icode sequence
        fun add_type_cast(e: IRegister, stype: MMType)
        do
-               var c = expr(new ITypeCheck(e, stype), module.type_bool)
+               var c = expr(new ITypeCheck(e, stype), mmmodule.type_bool)
                var iif = new IIf(c)
                stmt(iif)
                var old_seq = seq
@@ -74,7 +74,7 @@ class ICodeBuilder
        fun add_attr_check(prop: MMAttribute, e: IRegister)
        do
                if not prop.signature.return_type.is_nullable then
-                       var cond = expr(new IAttrIsset(prop, e), module.type_bool)
+                       var cond = expr(new IAttrIsset(prop, e), mmmodule.type_bool)
                        var iif = new IIf(cond)
                        stmt(iif)
                        var seq_old = seq
@@ -94,7 +94,7 @@ class ICodeBuilder
        # Add a localized IAbort
        fun add_abort(s: String...)
        do
-               stmt(new IAbort(s, module))
+               stmt(new IAbort(s, mmmodule))
        end
 
        # Add an assigment to the iroutine return value
@@ -114,7 +114,7 @@ class ICodeBuilder
                if prop.name == ne then
                        var eqp = prop.signature.recv.local_class.select_method(ee)
                        var eqcall = add_call(eqp, args, closcns).as(not null)
-                       return expr(new INot(eqcall), module.type_bool)
+                       return expr(new INot(eqcall), mmmodule.type_bool)
                end
 
                # TODO: Inline x==y as "x is y or (x != null and (== is not the Object one) and x.==(y))"
@@ -123,9 +123,9 @@ class ICodeBuilder
                icall.closure_defs = closcns
                if prop.name == ee then
                        # Prepare the result
-                       var reg = new_register(module.type_bool)
+                       var reg = new_register(mmmodule.type_bool)
                        # "x is y"
-                       var cond = expr(new IIs(args[0], args[1]), module.type_bool)
+                       var cond = expr(new IIs(args[0], args[1]), mmmodule.type_bool)
                        var iif = new IIf(cond)
                        stmt(iif)
                        var seq_old = seq
@@ -136,7 +136,7 @@ class ICodeBuilder
                        # Do the "x != null" part iff x is nullable
                        if args[0].stype.is_nullable then
                                var nul = lit_null_reg
-                               cond = expr(new IIs(args[0], nul), module.type_bool)
+                               cond = expr(new IIs(args[0], nul), mmmodule.type_bool)
                                iif = new IIf(cond)
                                stmt(iif)
                                seq = iif.then_seq
@@ -144,7 +144,7 @@ class ICodeBuilder
                                seq = iif.else_seq
                        end
                        # "x.==(y)"
-                       add_assignment(reg, expr(icall, module.type_bool))
+                       add_assignment(reg, expr(icall, mmmodule.type_bool))
                        seq = seq_old
                        return reg
                end
@@ -175,21 +175,21 @@ class ICodeBuilder
        # Return a literal "null" value
        fun lit_null_reg: IRegister
        do
-               return new_register(module.type_none)
+               return new_register(mmmodule.type_none)
        end
 
        # Return a literal "true" value
        fun lit_true_reg: IRegister
        do
                var e = new IBoolValue(true)
-               return expr(e, module.type_bool)
+               return expr(e, mmmodule.type_bool)
        end
 
        # Return a literal "false" value
        fun lit_false_reg: IRegister
        do
                var e = new IBoolValue(false)
-               return expr(e, module.type_bool)
+               return expr(e, mmmodule.type_bool)
        end
 
        # Get a new register
@@ -201,7 +201,7 @@ class ICodeBuilder
        end
 
        # The module where classes and types are extracted
-       readable var _module: MMModule
+       readable var _mmmodule: MMModule
 
        # The current iroutine build
        readable var _iroutine: IRoutine
@@ -209,9 +209,9 @@ class ICodeBuilder
        # The current sequence of icodes
        readable writable var _seq: ISeq
 
-       init(module: MMModule, r: IRoutine)
+       init(mod: MMModule, r: IRoutine)
        do
-               _module = module
+               _mmmodule = mod
                _current_location = r.location
                _iroutine = r
                _seq = r.body
index cc321ac..4ac84e0 100644 (file)
@@ -40,11 +40,11 @@ class MMContext
        readable var _modules: Array[MMModule] = new Array[MMModule]
 
        # Register a new module with the modules it depends on
-       fun add_module(module: MMModule, supers: Array[MMModule])
+       fun add_module(mod: MMModule, supers: Array[MMModule])
        do
-               _module_hierarchy.add(module, _module_hierarchy.select_smallests(supers))
-               _modules.add(module)
-               module._mhe = _module_hierarchy[module]
+               _module_hierarchy.add(mod, _module_hierarchy.select_smallests(supers))
+               _modules.add(mod)
+               mod._mhe = _module_hierarchy[mod]
        end
 
        # Register a global class
@@ -88,10 +88,10 @@ class MMDirectory
        readable var _modules: Map[Symbol, MMModule] = new HashMap[Symbol, MMModule]
 
        # Register a new module
-       fun add_module(module: MMModule)
+       fun add_module(mod: MMModule)
        do
-               assert not _modules.has_key(module.name)
-               _modules[module.name] = module
+               assert not _modules.has_key(mod.name)
+               _modules[mod.name] = mod
        end
 
        init(name: Symbol, path: String, parent: nullable MMDirectory) do
@@ -271,9 +271,9 @@ class MMGlobalClass
        end
 
        # The module that introduces the global class
-       fun module: MMModule
+       fun mmmodule: MMModule
        do
-               return intro.module
+               return intro.mmmodule
        end
 
        redef fun to_s
@@ -286,7 +286,7 @@ class MMGlobalClass
        do
                var sup = new Array[MMLocalClass]
                for s in class_refinement_hierarchy do
-                       if c.module.mhe < s.module and s isa MMConcreteClass then
+                       if c.mmmodule.mhe < s.mmmodule and s isa MMConcreteClass then
                                sup.add(s)
                        end
                end
@@ -331,7 +331,7 @@ class MMLocalClass
        readable var _arity : Int 
 
        # The module of the local class
-       readable var _module: MMModule
+       readable var _mmmodule: MMModule
 
        # The global class of the local class
        fun global: MMGlobalClass do return _global.as(not null)
@@ -364,7 +364,7 @@ class MMLocalClass
        # Create a new class with a given name and arity
        protected init(mod: MMModule, name: Symbol, arity: Int)
        do
-               _module = mod
+               _mmmodule = mod
                _name = name
                _arity = arity
                mod._local_classes.add(self)
@@ -380,8 +380,8 @@ class MMLocalClass
        fun new_global
        do
                var g = new MMGlobalClass(self)
-               _module._global_classes.add(g)
-               _module._global_class_by_name[name] = g
+               _mmmodule._global_classes.add(g)
+               _mmmodule._global_class_by_name[name] = g
                set_global(g)
        end
 
@@ -392,7 +392,7 @@ class MMLocalClass
        do
                _global = g
                _global.register_local_class(self)
-               _module.register_global_class(self)
+               _mmmodule.register_global_class(self)
        end
 
        # Is there a global propery with a given name
@@ -499,7 +499,7 @@ class MMLocalClass
        end
 
        # The current MMContext
-       fun context: MMContext do return module.context
+       fun context: MMContext do return mmmodule.context
 
        redef fun to_s
        do
@@ -512,9 +512,9 @@ class MMLocalClass
                var a = self
                if a == b then
                        return 0
-               else if a.module.mhe < b.module then
+               else if a.mmmodule.mhe < b.mmmodule then
                        return 1
-               else if b.module.mhe < a.module then
+               else if b.mmmodule.mhe < a.mmmodule then
                        return -1
                end
                var ar = a.cshe.rank
@@ -605,17 +605,17 @@ class MMLocalProperty
        fun prhe: PartialOrderElement[MMLocalProperty] do return _prhe.as(not null)
 
        # The module of the local property
-       fun module: MMModule do return _local_class.module
+       fun mmmodule: MMModule do return _local_class.mmmodule
 
        # Full expanded name with all qualifications
        fun full_name: String
        do
                if _global == null then
-                       return "{local_class.module}::{local_class}::(?::{name})"
+                       return "{local_class.mmmodule}::{local_class}::(?::{name})"
                else if global.intro == self then
-                       return "{local_class.module}::{local_class}::{name}"
+                       return "{local_class.mmmodule}::{local_class}::{name}"
                else
-                       return "{local_class.module}::{local_class}::({global.intro.full_name})"
+                       return "{local_class.mmmodule}::{local_class}::({global.intro.full_name})"
                end
        end
 
index 79efb24..e2d0962 100644 (file)
@@ -71,7 +71,7 @@ redef class MMLocalClass
                        for i in [0..arity[ do
                                var oft = global.intro.get_formal(i)
                                var ft = _formals_types[i] 
-                               ft.bound = oft.bound.for_module(module)
+                               ft.bound = oft.bound.for_module(mmmodule)
                        end
                end
                return _formals_types
@@ -134,7 +134,7 @@ special MMTypeClass
        redef fun for_module(mod)
        do
                var t: MMType = self
-               if module != mod then
+               if mmmodule != mod then
                        var parms = new Array[MMType]
                        for p in _params do
                                parms.add(p.for_module(mod))
@@ -201,12 +201,12 @@ special MMTypeFormal
        # The position is self in def_class
        readable var _position: Int 
 
-       redef fun module do return _def_class.module
+       redef fun mmmodule do return _def_class.mmmodule
 
        redef fun for_module(mod)
        do
                var t: MMType = self
-               if module != mod then
+               if mmmodule != mod then
                        t = mod[_def_class.global].get_formal(position)
                end
                return t
@@ -225,8 +225,8 @@ special MMTypeFormal
                r = r.direct_type
                var old_r = r.upcast_for(def_class)
                #if not old_r isa MMTypeGeneric then
-               #       print "adapt {self}'{def_class}'{self.module} to {r}'{r.module}"
-               #       print "   old_r = {old_r}'{old_r.module}"
+               #       print "adapt {self}'{def_class}'{self.mmmodule} to {r}'{r.mmmodule}"
+               #       print "   old_r = {old_r}'{old_r.mmmodule}"
                #end
                assert old_r isa MMTypeGeneric
                var reduct = old_r.params[position]
index 196ef85..170e038 100644 (file)
@@ -81,7 +81,7 @@ redef class MMLocalClass
                var set = new HashSet[MMLocalClass]
                set.add_all(supers)
                var u = set.to_a
-               module.set_supers_class(self,u)
+               mmmodule.set_supers_class(self,u)
                assert _crhe != null
                assert _cshe != null
                _computing_super = false
@@ -123,7 +123,7 @@ redef class MMLocalClass
                                set.add(glob) # Add the global property
 
                                # Do not inherit constructors trough specialization
-                               #print "{c.module}::{c} -> {module}::{self} for {glob.local_property.local_class.module}::{glob.local_property.local_class}::{glob.local_property} : {glob.is_init}"
+                               #print "{c.mmmodule}::{c} -> {mmmodule}::{self} for {glob.local_property.local_class.mmmodule}::{glob.local_property.local_class}::{glob.local_property} : {glob.is_init}"
                                if glob.is_init and glob.intro.local_class.global != global then
                                        #print "pass"
                                        continue
@@ -233,7 +233,7 @@ redef class MMLocalClass
                if _ancestors.has_key(c) then
                        return _ancestors[c]
                end
-               var a = c.for_module(module)
+               var a = c.for_module(mmmodule)
                assert cshe <= a
                var ra: MMAncestor
                if _ancestors.has_key(a) then
@@ -262,7 +262,7 @@ redef class MMLocalClass
        private fun add_default_any_class(supers: Array[MMLocalClass])
        do
                if supers.is_empty and name != once ("Object".to_symbol) then
-                       var t_any = module.type_any
+                       var t_any = mmmodule.type_any
                        supers.add(t_any.local_class)
                        var default = new MMDefaultAncestor(self, t_any)
                        add_direct_parent(default)
@@ -275,7 +275,7 @@ redef class MMLocalClass
                assert _crhe != null
                for ref in _crhe.direct_greaters do
                        for sup in ref.cshe.direct_greaters do
-                               var cla = sup.for_module(_module)
+                               var cla = sup.for_module(_mmmodule)
                                supers.add(cla)
                        end
                end
@@ -399,7 +399,7 @@ redef class MMLocalClass
                        # Conflict case (FIXME)
                        if impls2.length != 1 then
                                stderr.write("Fatal error: inherit_local_property error\n")
-                               print("------- {module}::{self} {glob.intro.full_name}")
+                               print("------- {mmmodule}::{self} {glob.intro.full_name}")
                                for i in impls2 do
                                        print("   {i.full_name}")
                                end
@@ -444,8 +444,8 @@ redef class MMAncestor
                tab.add(self)
                stype.local_class.compute_ancestors
                for anc in stype.local_class.ancestors.as(not null) do
-                       var aaa = anc.stype.for_module(stype.module)
-                       var a = aaa.adapt_to(stype).for_module(inheriter.module)
+                       var aaa = anc.stype.for_module(stype.mmmodule)
+                       var a = aaa.adapt_to(stype).for_module(inheriter.mmmodule)
                        if a.local_class != inheriter.local_class then
                                var it = tab.iterator
                                var b = true
index 063559e..15d735a 100644 (file)
@@ -102,7 +102,7 @@ class MMSignature
                if self == s then
                        return true
                end
-               assert _recv.module == s.recv.module
+               assert _recv.mmmodule == s.recv.mmmodule
                var rt = _return_type
                var srt = s.return_type
                if arity != s.arity or (rt == null) != (srt == null) then return false
@@ -155,7 +155,7 @@ class MMSignature
                if _recv == r then
                        return self
                end
-               var mod = r.module
+               var mod = r.mmmodule
                var p = new Array[MMType]
                for i in _params do
                        p.add(i.for_module(mod).adapt_to(r))
@@ -283,7 +283,7 @@ abstract class MMAncestor
        fun inheriter: MMType do return _inheriter.as(not null)
 
        fun is_reffinement: Bool do
-               return stype.module != stype.module
+               return stype.mmmodule != stype.mmmodule
        end
 
        fun is_specialisation: Bool do
@@ -307,7 +307,7 @@ end
 # Note that static type a related to a specific module
 abstract class MMType
        # The module where self makes sence
-       fun module: MMModule is abstract
+       fun mmmodule: MMModule is abstract
 
        # The local class that self direclty or indirectly refers to
        fun local_class: MMLocalClass is abstract
@@ -387,7 +387,7 @@ special MMType
        redef fun as_nullable do return self
        init(t: MMType) do _base_type = t
 
-       redef fun module do return _base_type.module
+       redef fun mmmodule do return _base_type.mmmodule
 
        redef fun local_class do return _base_type.local_class
 
@@ -430,7 +430,7 @@ end
 class MMTypeClass 
 special MMType
        redef readable var _local_class: MMLocalClass
-       redef fun module do return _local_class.module end
+       redef fun mmmodule do return _local_class.mmmodule end
        redef fun <(t) do return t.is_supertype(self)
 
        redef fun to_s
@@ -463,7 +463,7 @@ special MMTypeClass
        redef fun for_module(mod)
        do
                var t: MMType = self
-               if module != mod then
+               if mmmodule != mod then
                        t = _local_class.for_module(mod).get_type
                end
                return t
@@ -480,7 +480,7 @@ end
 # The type of null
 class MMTypeNone
 special MMType
-       redef readable var _module: MMModule
+       redef readable var _mmmodule: MMModule
        redef fun is_nullable: Bool do return true
        redef fun <(t) do return t isa MMTypeNone or t isa MMNullableType
        redef fun to_s do return "null"
@@ -490,7 +490,7 @@ special MMType
        redef fun as_nullable do return self
        redef fun as_notnull do abort
 
-       private init(m: MMModule) do _module = m
+       private init(m: MMModule) do _mmmodule = m
 end
 
 redef class MMModule
index fa2b2aa..7b09814 100644 (file)
@@ -68,11 +68,11 @@ special MMTypeFormal
                _recv = recv
        end
 
-       redef fun module do return _recv.module
+       redef fun mmmodule do return _recv.mmmodule
 
        redef fun for_module(mod)
        do
-               if mod == module then return self
+               if mod == mmmodule then return self
                return adapt_to(recv.for_module(mod))
        end
 
index 4dfc361..4b9b578 100644 (file)
@@ -364,7 +364,7 @@ class ModuleLoader
        protected fun parse_file(context: ToolContext, file: IFStream, filename: String, module_name: Symbol, dir: MMDirectory): MODULE is abstract
 
        # Process a parsed module
-       protected fun process_metamodel(context: ToolContext, module: MODULE) is abstract
+       protected fun process_metamodel(context: ToolContext, mod: MODULE) is abstract
 end
 
 redef class MMModule
index a8e1b45..806756b 100644 (file)
@@ -65,8 +65,8 @@ special AbstractCompiler
                f.close
        end
 
-       # Currently computed module
-       readable var _module: nullable MMSrcModule
+       # Currently computed mmmodule
+       readable var _mmmodule: nullable MMSrcModule
 
        # Is the current directory module computed as a simple modude ?
        readable writable var _inside_mode: Bool = false
@@ -82,7 +82,7 @@ special AbstractCompiler
        do
                _entities.add(e)
                if e isa MMSrcModule then
-                       _module = e
+                       _mmmodule = e
                end
        end
 
@@ -96,7 +96,7 @@ special AbstractCompiler
        fun extract_other_doc
        do
                info("Generating other files",1)
-               _module = null
+               _mmmodule = null
                inside_mode = false
                intrude_mode = false
                clear
@@ -187,23 +187,23 @@ special AbstractCompiler
                add("<a href=\"overview.html\"><b>Overview</b></a>&nbsp; <a href=\"index-1.html\"><b>Index</b></a>&nbsp; <a href=\"index.html\" target=\"_top\"><b>With Frames</b></a>\n")
                add("</td></tr></table>")
                add("Visibility: ")
-               var module = module
-               if (not inside_mode and not intrude_mode) or module == null then
+               var mod = mmmodule
+               if (not inside_mode and not intrude_mode) or mod == null then
                        add("<b>Public</b>&nbsp; ")
                else
-                       add("<a href=\"{module}.html\"><b>Public</b></a>&nbsp; ")
+                       add("<a href=\"{mod}.html\"><b>Public</b></a>&nbsp; ")
                end
-               if inside_mode or module == null then
+               if inside_mode or mod == null then
                        add("<b>Inside</b>&nbsp; ")
-               else if module.directory.owner != module then
+               else if mod.directory.owner != mod then
                        add("<strike><b>Inside</b></strike>&nbsp; ")
                else
-                       add("<a href=\"{module}_.html\"><b>Inside</b></a>&nbsp; ")
+                       add("<a href=\"{mod}_.html\"><b>Inside</b></a>&nbsp; ")
                end
-               if intrude_mode or module == null then
+               if intrude_mode or mod == null then
                        add("<b>Intrude</b>&nbsp; ")
                else
-                       add("<a href=\"{module}__.html\"><b>Intrude</b></a>&nbsp; ")
+                       add("<a href=\"{mod}__.html\"><b>Intrude</b></a>&nbsp; ")
                end
                add("<br/>")
        end
@@ -223,11 +223,11 @@ special AbstractCompiler
        # if inside_mode is set, it could be a different result
        fun known_owner_of(m: MMModule): MMModule
        do
-               var module = module
-               if module == null then return m
-               var res = module.known_owner_of(m)
-               if not inside_mode and not intrude_mode and res.directory.owner == module then
-                       return module
+               var mod = mmmodule
+               if mod == null then return m
+               var res = mod.known_owner_of(m)
+               if not inside_mode and not intrude_mode and res.directory.owner == mod then
+                       return mod
                else
                        return res
                end
@@ -333,7 +333,7 @@ end
 redef class MMModule
 special MMEntity
        redef fun html_link(dctx) do 
-               if dctx.module == self then 
+               if dctx.mmmodule == self then
                        return "{self}"
                else
                        return "<a href=\"{self}.html\">{self}</a>"
@@ -345,18 +345,18 @@ special MMEntity
        var _known_owner_of_cache: Map[MMModule, MMModule] = new HashMap[MMModule, MMModule]
 
        # Return the owner of `module` from the point of view of `self`
-       fun known_owner_of(module: MMModule): MMModule
+       fun known_owner_of(mod: MMModule): MMModule
        do
-               if _known_owner_of_cache.has_key(module) then return _known_owner_of_cache[module]
-               var res = module
+               if _known_owner_of_cache.has_key(mod) then return _known_owner_of_cache[mod]
+               var res = mod
                # is module is publicly imported by self?
-               if mhe < module and visibility_for(module) != 0 then
-                       res = known_owner_of_intern(module, self, false)
+               if mhe < mod and visibility_for(mod) != 0 then
+                       res = known_owner_of_intern(mod, self, false)
                else
                        # Return the canonnical owner of module from the point of view of self
-                       res = module.owner(self)
+                       res = mod.owner(self)
                end
-               _known_owner_of_cache[module] = res
+               _known_owner_of_cache[mod] = res
                return res
        end
 
@@ -374,17 +374,17 @@ special MMEntity
        end
 
        # ???
-       private fun known_owner_of_intern(module: MMModule, from: MMModule, as_owner: Bool): MMModule
+       private fun known_owner_of_intern(mod: MMModule, from: MMModule, as_owner: Bool): MMModule
        do
-               if module == self then return self
+               if mod == self then return self
                var candidates = new Array[MMModule]
                for m in explicit_imported_modules do
                        if from.visibility_for(m) == 0 then continue
-                       if not m.mhe <= module then continue
-                       candidates.add(m.known_owner_of_intern(module, from, true))
+                       if not m.mhe <= mod then continue
+                       candidates.add(m.known_owner_of_intern(mod, from, true))
                end
                # FIXME: I do not know what this does
-               if candidates.is_empty then return module.owner(from)
+               if candidates.is_empty then return mod.owner(from)
                var max = candidates.first
                for m in candidates do
                        if max.mhe < m then max = m
@@ -408,10 +408,10 @@ special MMEntity
 
        redef fun html_link(dctx)
        do
-               var m = module
-               if not need_doc(dctx) then m = global.intro.module
+               var m = mmmodule
+               if not need_doc(dctx) then m = global.intro.mmmodule
                m = dctx.known_owner_of(m)
-               if m == dctx.module then
+               if m == dctx.mmmodule then
                        return "<a href=\"#{html_anchor}\">{self}</a>"
                else
                        return "<a href=\"{m}.html#{html_anchor}\">{self}</a>"
@@ -423,12 +423,12 @@ special MMEntity
 
        redef fun locate(dctx)
        do
-               return "in {module.html_link(dctx)}::{local_class.html_link(dctx)}"
+               return "in {mmmodule.html_link(dctx)}::{local_class.html_link(dctx)}"
        end
 
        fun known_intro_class(dctx: DocContext): MMLocalClass
        do
-               var mod = dctx.known_owner_of(global.intro.local_class.module)
+               var mod = dctx.known_owner_of(global.intro.local_class.mmmodule)
                var cla = mod[global.intro.local_class.global]
                return cla
        end
@@ -449,9 +449,9 @@ special MMEntity
                if is_redef then
                        var gp = global.intro
                        if intro_class.global != local_class.global then
-                               res.append(" {module[intro_class.global].html_link(dctx)}::")
-                       else if intro_class.module != module then
-                               res.append(" {intro_class.module.html_link(dctx)}::")
+                               res.append(" {mmmodule[intro_class.global].html_link(dctx)}::")
+                       else if intro_class.mmmodule != mmmodule then
+                               res.append(" {intro_class.mmmodule.html_link(dctx)}::")
                        end
                end
                return res.to_s
@@ -476,7 +476,7 @@ special MMEntity
        do
                if global.visibility_level >= 3 or self isa MMAttribute then
                        if not dctx.intrude_mode then return false
-                       if dctx.module.visibility_for(module) == 0 then return false
+                       if dctx.mmmodule.visibility_for(mmmodule) == 0 then return false
                end
                if global.intro == self then
                        return true
@@ -702,10 +702,10 @@ special MMEntity
 
        redef fun html_link(dctx)
        do
-               var m = module
-               if not need_doc(dctx) then m = global.module
+               var m = mmmodule
+               if not need_doc(dctx) then m = global.mmmodule
                m = dctx.known_owner_of(m)
-               if m == dctx.module then
+               if m == dctx.mmmodule then
                        return "<a href=\"#{html_anchor}\">{self}</a>"
                else
                        return "<a href=\"{m}.html#{html_anchor}\">{self}</a>"
@@ -717,7 +717,7 @@ special MMEntity
        redef fun doc do return global.intro.doc
 
        redef fun need_doc(dctx) do
-               if module == dctx.module then
+               if mmmodule == dctx.mmmodule then
                        for m in dctx.owned_modules do
                                if m.global_classes.has(global) then
                                        var c = m[global]
@@ -728,9 +728,9 @@ special MMEntity
                return false
        end
 
-       redef fun locate(dctx) do return "in {module.html_link(dctx)}"
+       redef fun locate(dctx) do return "in {mmmodule.html_link(dctx)}"
 
-       fun known_intro(dctx: DocContext): MMLocalClass do return dctx.known_owner_of(global.intro.module)[global]
+       fun known_intro(dctx: DocContext): MMLocalClass do return dctx.known_owner_of(global.intro.mmmodule)[global]
 
        redef fun prototype_head(dctx)
        do
@@ -740,7 +740,7 @@ special MMEntity
                if is_redef then res.append("redef ")
                if global.visibility_level == 3 then res.append("private ")
                res.append("class ")
-               if is_redef then res.append("{ki.module.html_link(dctx)}::")
+               if is_redef then res.append("{ki.mmmodule.html_link(dctx)}::")
                return res.to_s
        end
 
@@ -763,26 +763,26 @@ special MMEntity
        # Extract the doc of a class
        fun extract_class_doc(dctx: DocContext)
        do
-               dctx.add("<a name=\"{html_anchor}\"></a><h2>{self}</h2><small>{module.html_link(dctx)}::</small><br/>{prototype_head(dctx)}<b>{self}</b>{prototype_body(dctx)}\n")
+               dctx.add("<a name=\"{html_anchor}\"></a><h2>{self}</h2><small>{mmmodule.html_link(dctx)}::</small><br/>{prototype_head(dctx)}<b>{self}</b>{prototype_body(dctx)}\n")
                dctx.add("<blockquote>\n")
                dctx.add("<dl>\n")
 
                var sup2 = new Array[String]
-               var intro_module = dctx.known_owner_of(global.module)
-               if intro_module != module then
+               var intro_module = dctx.known_owner_of(global.mmmodule)
+               if intro_module != mmmodule then
                        dctx.add("<dt>Refine {self} from: <dd>{intro_module.html_link(dctx)}\n")
                        sup2.clear
                        var mods = new Array[MMModule]
                        for c in crhe.greaters do
                                if c.need_doc(dctx) then
-                                       var km = dctx.known_owner_of(c.module)
-                                       if km != module and km != intro_module and not mods.has(km) then
+                                       var km = dctx.known_owner_of(c.mmmodule)
+                                       if km != mmmodule and km != intro_module and not mods.has(km) then
                                                mods.add(km)
                                        end
                                end
                        end
                        for c in crhe.linear_extension do
-                               if mods.has(c.module) then sup2.add(c.module.html_link(dctx))
+                               if mods.has(c.mmmodule) then sup2.add(c.mmmodule.html_link(dctx))
                        end
                        if not sup2.is_empty then dctx.add("<dt>Previous refinements in: <dd>{sup2.join(", ")}\n")
                end
@@ -809,7 +809,7 @@ special MMEntity
                sup2.clear
                for c in crhe.smallers do
                        c.compute_super_classes
-                       for c2 in c.module.local_classes do
+                       for c2 in c.mmmodule.local_classes do
                                if not c2 isa MMConcreteClass then continue
                                c2.compute_super_classes
                                c2.compute_ancestors
@@ -825,8 +825,8 @@ special MMEntity
                end
                sup2.clear
                for c in crhe.order do
-                       if not module.mhe <= c.module and c.need_doc(dctx) then
-                               sup2.add(c.module.html_link(dctx))
+                       if not mmmodule.mhe <= c.mmmodule and c.need_doc(dctx) then
+                               sup2.add(c.mmmodule.html_link(dctx))
                        end
                end
                if not sup2.is_empty then
@@ -876,7 +876,7 @@ special MMEntity
                var new_props = new Array[MMLocalProperty]
                for g in global_properties do
                        if not accept_prop(g.intro, pass) then continue
-                       if module.visibility_for(g.intro.module) < g.visibility_level then continue
+                       if mmmodule.visibility_for(g.intro.mmmodule) < g.visibility_level then continue
                        var p = self[g]
                        if p.local_class != self or not p.need_doc(dctx) then
                                var cla = new Array[MMLocalClass]
@@ -912,11 +912,11 @@ special MMEntity
                        var mmap = new HashMap[MMModule, Array[MMLocalProperty]]
                        for c in che.greaters do
                                if c isa MMSrcLocalClass then
-                                       var km = dctx.known_owner_of(c.module)
+                                       var km = dctx.known_owner_of(c.mmmodule)
                                        var kc = km[c.global]
                                        if kc == self then continue
                                        var props: Array[MMLocalProperty]
-                                       if km == module then
+                                       if km == mmmodule then
                                                if cmap.has_key(kc) then
                                                        props = cmap[kc]
                                                else
@@ -954,7 +954,7 @@ special MMEntity
 
                        dctx.open_stage
                        dctx.stage("<tr bgcolor=\"#EEEEFF\"><th colspan=\"2\"><small>Imported {passname}</small></th><tr>\n")
-                       for m in module.mhe.linear_extension do
+                       for m in mmmodule.mhe.linear_extension do
                                if not mmap.has_key(m) then continue
                                var props = mmap[m]
                                if props.is_empty then continue
@@ -968,9 +968,9 @@ special MMEntity
 
                var mmap = new HashMap[MMModule, Array[MMLocalProperty]]
                for c in crhe.order do
-                       if module.mhe <= c.module or dctx.owned_modules.has(c.module) or not c isa MMSrcLocalClass then continue
-                       var km = dctx.known_owner_of(c.module)
-                       if module.mhe <= km then continue
+                       if mmmodule.mhe <= c.mmmodule or dctx.owned_modules.has(c.mmmodule) or not c isa MMSrcLocalClass then continue
+                       var km = dctx.known_owner_of(c.mmmodule)
+                       if mmmodule.mhe <= km then continue
                        var kc = km[c.global]
                        var props: Array[MMLocalProperty]
                        if mmap.has_key(km) then
@@ -991,7 +991,7 @@ special MMEntity
                dctx.open_stage
                dctx.stage("<tr bgcolor=\"#EEEEFF\"><th colspan=\"2\"><small>Added {passname} in known modules</small></th><tr>\n")
                for c in crhe.order do
-                       var m = c.module
+                       var m = c.mmmodule
                        if not mmap.has_key(m) then continue
                        var props = mmap[m]
                        if props.is_empty then continue
@@ -1018,7 +1018,7 @@ special MMEntity
 
                dctx.open_stage
                for p in new_props do
-                       dctx.add("<a name=\"{p.html_anchor}\"></a><h3>{p}</h3><p><small>{p.module.html_link(dctx)}::{p.local_class.html_link(dctx)}::</small><br/>{p.prototype_head(dctx)} <b>{p.name}</b>{p.prototype_body(dctx)}</p>\n")
+                       dctx.add("<a name=\"{p.html_anchor}\"></a><h3>{p}</h3><p><small>{p.mmmodule.html_link(dctx)}::{p.local_class.html_link(dctx)}::</small><br/>{p.prototype_head(dctx)} <b>{p.name}</b>{p.prototype_body(dctx)}</p>\n")
                        dctx.add("<blockquote>")
                        var doc = p.doc
                        if doc != null then
@@ -1048,7 +1048,7 @@ special MMEntity
                if not properties.is_empty then
                        var s: String
                        if heir.global == global then
-                               s = module.html_link(dctx)
+                               s = mmmodule.html_link(dctx)
                        else
                                s = self.html_link(dctx)
                        end
@@ -1092,7 +1092,7 @@ redef class MMSrcLocalClass
        do
                if global.visibility_level >= 3 then
                        if not dctx.intrude_mode then return false
-                       if dctx.module.visibility_for(module) == 0 then return false
+                       if dctx.mmmodule.visibility_for(mmmodule) == 0 then return false
                end
                if global.intro == self then
                        return true
index 41e0cab..262228f 100644 (file)
@@ -44,8 +44,8 @@ redef class MMLocalClass
                var i = ctypes.iterator
                while i.is_ok do
                        var n = i.key
-                       if module.has_global_class_named(n) then
-                               var c = module.class_by_name(n)
+                       if mmmodule.has_global_class_named(n) then
+                               var c = mmmodule.class_by_name(n)
                                if cshe < c then
                                        _primitive_info_cache = i.item
                                        _primitive_info_b = true
index 7284fc6..5e6903e 100644 (file)
@@ -39,7 +39,7 @@ class Program
        readable var _tc: ToolContext
 
        # This module is the 'main' module, the one where we find the 'main' method
-       readable var _module: MMModule
+       readable var _main_module: MMModule
 
        # This method is the entry point of this program
        # There might be no entry point (if in fact we are compiling a library)
@@ -53,7 +53,7 @@ class Program
        # start using all the classes
        private fun finish_processing_classes do
                var classes = new Array[MMLocalClass]
-               for c in module.local_classes do
+               for c in main_module.local_classes do
                        c.compute_super_classes
                        classes.add(c)
                end
@@ -66,8 +66,8 @@ class Program
        fun compute_main_method do
                # Check for the 'Sys' class
                var sysname = once "Sys".to_symbol
-               if not module.has_global_class_named(sysname) then return
-               var sys = module.class_by_name(sysname)
+               if not main_module.has_global_class_named(sysname) then return
+               var sys = main_module.class_by_name(sysname)
 
                # Check for 'Sys::main' method
                var entryname = once "main".to_symbol
@@ -80,7 +80,7 @@ class Program
        # Generation of allocation function of this class
        fun generate_allocation_iroutines
        do
-               for c in module.local_classes do
+               for c in main_module.local_classes do
                        var pi = c.primitive_info
                        if pi == null then
                                do
@@ -88,7 +88,7 @@ class Program
                                        var iself = new IRegister(c.get_type)
                                        var iselfa = [iself]
                                        var iroutine = new IRoutine(iselfa, null)
-                                       var icb = new ICodeBuilder(module, iroutine)
+                                       var icb = new ICodeBuilder(main_module, iroutine)
 
                                        for g in c.global_properties do
                                                if not g.intro isa MMAttribute then continue
@@ -110,7 +110,7 @@ class Program
                                        var iself = new IRegister(c.get_type)
                                        var iselfa = [iself]
                                        var iroutine = new IRoutine(iselfa, null)
-                                       var icb = new ICodeBuilder(module, iroutine)
+                                       var icb = new ICodeBuilder(main_module, iroutine)
                                        for g in c.global_properties do
                                                if not g.intro isa MMAttribute then continue
                                                var p = c[g]
@@ -134,7 +134,7 @@ class Program
                                        for i in [0..p.signature.arity[ do iparams.add(new IRegister(p.signature[i]))
                                        var iroutine = new IRoutine(iparams, iself)
                                        iroutine.location = p.iroutine.location
-                                       var icb = new ICodeBuilder(module, iroutine)
+                                       var icb = new ICodeBuilder(main_module, iroutine)
 
                                        var inew = new IAllocateInstance(c.get_type)
                                        inew.result = iself
@@ -157,7 +157,7 @@ class Program
        fun with_each_iroutines
                !action(i: IRoutine, m: MMModule)
        do
-               for m in module.mhe.greaters_and_self do
+               for m in main_module.mhe.greaters_and_self do
                        for c in m.local_classes do
                                var iroutine: nullable IRoutine = null
 
@@ -193,7 +193,7 @@ class Program
        fun with_each_methods
                !action(m: MMMethod)
        do
-               for m in module.mhe.greaters_and_self do
+               for m in main_module.mhe.greaters_and_self do
                        for c in m.local_classes do
                                # Process methods and attributes initialization
                                for p in c.local_local_properties do
@@ -210,13 +210,13 @@ class Program
        fun with_each_live_local_classes
                !action(m: MMLocalClass)
        do
-               for c in module.local_classes do
+               for c in main_module.local_classes do
                        action(c)
                end
        end
 
        init(m: MMModule, toolcontext: ToolContext) do
-               _module = m
+               _main_module = m
                _tc = toolcontext
                finish_processing_classes
        end
index 11b45db..5bd50bb 100644 (file)
@@ -84,7 +84,7 @@ special ICodeBuilder
 
        init(visitor: AbsSyntaxVisitor, r: IRoutine, m: nullable MMMethod)
        do
-               super(visitor.module, r)
+               super(visitor.mmmodule, r)
                _visitor = visitor
                _return_seq = r.body
                _return_value = r.result
@@ -787,7 +787,7 @@ redef class AOrElseExpr
 
                # Compare left and null
                var n = v.lit_null_reg
-               var c = v.expr(new IIs(e, n), v.module.type_bool)
+               var c = v.expr(new IIs(e, n), v.mmmodule.type_bool)
                var iif = new IIf(c)
                v.stmt(iif)
                var old_seq = v.seq
index 585c70c..faddda5 100644 (file)
@@ -59,7 +59,7 @@ redef class MMSrcModule
 
                # Compute specialization relation
                for c in local_classes do
-                       if visibility_for(c.global.intro.module) < c.global.visibility_level then
+                       if visibility_for(c.global.intro.mmmodule) < c.global.visibility_level then
                                continue
                        end
                        c.compute_super_classes
@@ -461,8 +461,8 @@ end
 redef class APackagedecl
        redef fun accept_class_builder(v)
        do
-               if n_id.to_symbol != v.module.name then
-                       v.error(n_id, "Error: Package name missmatch between {v.module.name} and {n_id.to_symbol}")
+               if n_id.to_symbol != v.mmmodule.name then
+                       v.error(n_id, "Error: Package name missmatch between {v.mmmodule.name} and {n_id.to_symbol}")
                end
        end
 end
@@ -525,7 +525,7 @@ redef class AClassdef
        redef fun accept_class_builder(v)
        do
                var local_class: MMSrcLocalClass
-               var mod = v.module
+               var mod = v.mmmodule
                var local_classes = mod.src_local_classes
                if (local_classes.has_key(name)) then
                        local_class = local_classes[name]
@@ -630,7 +630,7 @@ redef class AStdClassdef
 
                # Redef
 
-               glob.check_visibility(v, self, v.module)
+               glob.check_visibility(v, self, v.mmmodule)
                if n_kwredef == null then
                        v.error(self, "Redef error: {name} is an imported class. Add the redef keyword to refine it.")
                        return
@@ -691,14 +691,14 @@ redef class AFormaldef
                var o = c.global.intro
                if c == o then
                        if n_type == null then
-                               _formal.bound = v.module.type_any.as_nullable
+                               _formal.bound = v.mmmodule.type_any.as_nullable
                        else
                                var stype = n_type.get_stype(v)
                                if stype == null then return
                                _formal.bound = stype
                        end
                else
-                       var ob = o.get_formal(_formal.position).bound.for_module(v.module)
+                       var ob = o.get_formal(_formal.position).bound.for_module(v.mmmodule)
                        if n_type == null then
                                _formal.bound = ob
                        else
@@ -842,7 +842,7 @@ redef class APropdef
                end
 
                var s = prop.signature
-               #print "process {prop.local_class.module}::{prop.local_class}::{prop} from global {prop.global.local_property.local_class.module}::{prop.global.local_property.local_class}::{prop.global.local_property}"
+               #print "process {prop.local_class.mmmodule}::{prop.local_class}::{prop} from global {prop.global.local_property.local_class.mmmodule}::{prop.global.local_property.local_class}::{prop.global.local_property}"
                for i in prop.prhe.direct_greaters do
                        var ip = i.local_class[prop.global]
                        var isig = i.signature.adaptation_to(v.local_class.get_type)
@@ -908,7 +908,7 @@ redef class APropdef
                if visibility_level != 1 and glob.visibility_level != visibility_level then
                        v.error(self, "Redef error: {prop.local_class}::{prop} redefinition cannot change visibility.")
                end
-               glob.check_visibility(v, self, v.module, true)
+               glob.check_visibility(v, self, v.mmmodule, true)
        end
 end
 
@@ -1059,7 +1059,7 @@ redef class AExternMethPropdef
                        ename = n_extern.text
                        ename = ename.substring(1, ename.length-2)
                else
-                       ename = "{method.module.name}_{method.local_class.name}_{method.local_class.name}_{method.name}_{method.signature.arity}"
+                       ename = "{method.mmmodule.name}_{method.local_class.name}_{method.local_class.name}_{method.name}_{method.signature.arity}"
                end
                method.extern_name = ename
        end
@@ -1231,7 +1231,7 @@ redef class AClosureDecl
                end
 
                # Add the finalizer to the closure signature
-               var finalize_sig = new MMSignature(new Array[MMType], null, v.module.type_any) # FIXME should be no receiver
+               var finalize_sig = new MMSignature(new Array[MMType], null, v.mmmodule.type_any) # FIXME should be no receiver
                var finalizer_clos = new MMClosure(once ("break".to_symbol), finalize_sig, false, true)
                sig.closures.add(finalizer_clos)
 
index 4ec5516..0270e2e 100644 (file)
@@ -43,15 +43,15 @@ special ModuleLoader
                var node_module = node_tree.n_base
                assert node_module != null
                var module_loc = new Location.with_file(filename)
-               var module = new MMSrcModule(context, node_module, dir, name, module_loc)
-               return module
+               var mod = new MMSrcModule(context, node_module, dir, name, module_loc)
+               return mod
        end
 
-       redef fun process_metamodel(context, module)
+       redef fun process_metamodel(context, mod)
        do
-               module.process_supermodules(context)
-               context.info("Syntax analysis for module: {module.name}", 2)
-               module.process_syntax(context)
+               mod.process_supermodules(context)
+               context.info("Syntax analysis for module: {mod.name}", 2)
+               mod.process_syntax(context)
        end
 
        init do end
index 2d0ef27..68f8fa2 100644 (file)
@@ -65,7 +65,7 @@ end
 redef class MMGlobalClass
        # Check that a module can access a class
        fun check_visibility(v: AbsSyntaxVisitor, n: ANode, cm: MMSrcModule): Bool do
-               var pm = intro.module
+               var pm = intro.mmmodule
                assert pm isa MMSrcModule
                var vpm = cm.visibility_for(pm)
                if vpm == 3 then
@@ -85,7 +85,7 @@ end
 class MMSrcLocalClass
 special MMConcreteClass
        # The first related AST node (if any)
-       fun node: nullable AClassdef do return module.nodes(self).as(nullable AClassdef)
+       fun node: nullable AClassdef do return mmmodule.nodes(self).as(nullable AClassdef)
 
        # Concrete NIT source generic formal parameter by name
        readable var _formal_dict: Map[Symbol, MMTypeFormalParameter] = new HashMap[Symbol, MMTypeFormalParameter]
@@ -104,7 +104,7 @@ end
 redef class MMGlobalProperty
        # Check that a module can access a property
        fun check_visibility(v: AbsSyntaxVisitor, n: ANode, cm: MMSrcModule, allows_protected: Bool): Bool do
-               var pm = local_class.module
+               var pm = local_class.mmmodule
                assert pm isa MMSrcModule
                var vpm = cm.visibility_for(pm)
                if vpm == 3 then
@@ -135,11 +135,11 @@ end
 # Concrete NIT source attribute
 class MMSrcAttribute
 special MMAttribute
-       redef fun node: nullable AAttrPropdef do return module.nodes(self).as(nullable AAttrPropdef)
+       redef fun node: nullable AAttrPropdef do return mmmodule.nodes(self).as(nullable AAttrPropdef)
        init(name: Symbol, cla: MMLocalClass, n: AAttrPropdef)
        do
                super(name, cla)
-               cla.module.nodes(self) = n
+               cla.mmmodule.nodes(self) = n
        end
 end
 
@@ -154,11 +154,11 @@ end
 # Concrete NIT source method for an automatic accesor
 class MMAttrImplementationMethod
 special MMSrcMethod
-       redef fun node: nullable AAttrPropdef do return module.nodes(self).as(nullable AAttrPropdef)
+       redef fun node: nullable AAttrPropdef do return mmmodule.nodes(self).as(nullable AAttrPropdef)
        init(name: Symbol, cla: MMLocalClass, n: AAttrPropdef)
        do
                super(name, cla)
-               cla.module.nodes(self) = n
+               cla.mmmodule.nodes(self) = n
        end
 end
 
@@ -187,11 +187,11 @@ special MMSrcMethod
        redef readable var _is_intern: Bool
        redef readable var _is_abstract: Bool
        redef readable writable var _extern_name: nullable String # Will be computed during MMBuilder
-       redef fun node: nullable AMethPropdef do return module.nodes(self).as(nullable AMethPropdef)
+       redef fun node: nullable AMethPropdef do return mmmodule.nodes(self).as(nullable AMethPropdef)
        init(name: Symbol, cla: MMLocalClass, n: nullable AMethPropdef)
        do
                super(name, cla)
-               cla.module.nodes(self) = n
+               cla.mmmodule.nodes(self) = n
                _is_init = node isa AConcreteInitPropdef
                _is_intern = node isa AInternMethPropdef
                _is_abstract = node isa ADeferredMethPropdef
@@ -290,15 +290,15 @@ class AbsSyntaxVisitor
 special Visitor
        fun get_type_by_name(clsname: Symbol): MMType
        do
-               if not _module.has_global_class_named(clsname) then _tc.fatal_error(_module.location, "Missing necessary class: \"{clsname}\"")
-               var cls = _module.class_by_name(clsname)
+               if not _mmmodule.has_global_class_named(clsname) then _tc.fatal_error(_mmmodule.location, "Missing necessary class: \"{clsname}\"")
+               var cls = _mmmodule.class_by_name(clsname)
                return cls.get_type
        end
 
        fun get_instantiated_type_by_name(clsname: Symbol, vtype: Array[MMType]): MMType
        do
-               if not _module.has_global_class_named(clsname) then _tc.fatal_error(_module.location, "Missing necessary class: \"{clsname}\"")
-               var cls = _module.class_by_name(clsname)
+               if not _mmmodule.has_global_class_named(clsname) then _tc.fatal_error(_mmmodule.location, "Missing necessary class: \"{clsname}\"")
+               var cls = _mmmodule.class_by_name(clsname)
                return cls.get_instantiate_type(vtype)
        end
 
@@ -371,7 +371,7 @@ special Visitor
        # The primitive type of null
        fun type_none: MMType
        do
-               return _module.type_none
+               return _mmmodule.type_none
        end
 
        fun get_method(recv: MMType, name: Symbol): MMMethod
@@ -383,7 +383,7 @@ special Visitor
        end
 
        # The current module
-       readable var _module: MMSrcModule
+       readable var _mmmodule: MMSrcModule
 
        # The current class
        fun local_class: MMSrcLocalClass do return _local_class.as(not null)
@@ -494,10 +494,10 @@ special Visitor
                return stype
        end
 
-       protected init(tc: ToolContext, module: MMSrcModule)
+       protected init(tc: ToolContext, mmmodule: MMSrcModule)
        do
                _tc = tc
-               _module = module
+               _mmmodule = mmmodule
        end
 end
 
@@ -596,7 +596,7 @@ redef class AType
        fun get_local_class(v: AbsSyntaxVisitor): nullable MMLocalClass
        do
                var name = n_id.to_symbol
-               var mod = v.module
+               var mod = v.mmmodule
                var cla = v.local_class
 
                if cla.formal_dict.has_key(name) or cla.has_global_property_by_name(name) then
@@ -626,7 +626,7 @@ redef class AType
                _stype_cached = true
 
                var name = n_id.to_symbol
-               var mod = v.module
+               var mod = v.mmmodule
                var cla = v.local_class
                var t: nullable MMType
 
index b7e324a..e125491 100644 (file)
@@ -109,7 +109,7 @@ special AbsSyntaxVisitor
        # Number of nested once
        readable writable var _once_count: Int = 0
 
-       init(tc, module) do super
+       init(tc, mod) do super
 
        private fun get_default_constructor_for(n: ANode, c: MMLocalClass, prop: MMSrcMethod): nullable MMMethod
        do
@@ -247,7 +247,7 @@ redef class AConcreteInitPropdef
                        var cur_c: nullable MMLocalClass = null
                        if i < l then
                                cur_m = explicit_super_init_calls[i]
-                               cur_c = cur_m.global.intro.local_class.for_module(v.module)
+                               cur_c = cur_m.global.intro.local_class.for_module(v.mmmodule)
                        end
                        var j = 0
                        while j < v.local_class.cshe.direct_greaters.length do
@@ -260,7 +260,7 @@ redef class AConcreteInitPropdef
                                        i += 1
                                        if i < l then
                                                cur_m = explicit_super_init_calls[i]
-                                               cur_c = cur_m.global.intro.local_class.for_module(v.module)
+                                               cur_c = cur_m.global.intro.local_class.for_module(v.mmmodule)
                                        else
                                                cur_m = null
                                                cur_c = null
@@ -752,7 +752,7 @@ redef class AReassignFormExpr
                        return null
                end
                var prop = lc.select_method(name)
-               prop.global.check_visibility(v, self, v.module, false)
+               prop.global.check_visibility(v, self, v.mmmodule, false)
                var psig = prop.signature_for(type_lvalue)
                _assign_method = prop
                if not v.check_conform_expr(n_value, psig[0].not_for_self) then return null
@@ -1100,7 +1100,7 @@ redef class ASuperExpr
                        var stype: nullable MMType = null
                        for prop in precs do
                                assert prop isa MMMethod
-                               var t = prop.signature_for(v.self_var.stype.as(not null)).return_type.for_module(v.module).adapt_to(v.local_property.signature.recv)
+                               var t = prop.signature_for(v.self_var.stype.as(not null)).return_type.for_module(v.mmmodule).adapt_to(v.local_property.signature.recv)
                                stypes.add(t)
                                if stype == null or stype < t then
                                        stype = t
@@ -1141,8 +1141,8 @@ redef class AAttrFormExpr
                        return
                end
                var prop = lc.select_attribute(name)
-               if v.module.visibility_for(prop.global.local_class.module) < 3 then
-                       v.error(self, "Error: Attribute {name} from {prop.global.local_class.module} is invisible in {v.module}")
+               if v.mmmodule.visibility_for(prop.global.local_class.mmmodule) < 3 then
+                       v.error(self, "Error: Attribute {name} from {prop.global.local_class.mmmodule} is invisible in {v.mmmodule}")
                end
                _prop = prop
                var at = prop.signature_for(type_recv).return_type 
@@ -1365,7 +1365,7 @@ redef class AAbsSendExpr
        # Get the signature for a local property and a receiver
        private fun get_signature(v: TypingVisitor, type_recv: MMType, prop: MMMethod, recv_is_self: Bool): MMSignature
        do
-               prop.global.check_visibility(v, self, v.module, recv_is_self)
+               prop.global.check_visibility(v, self, v.mmmodule, recv_is_self)
                var psig = prop.signature_for(type_recv)
                if not recv_is_self then psig = psig.not_for_self
                return psig
@@ -1387,7 +1387,7 @@ redef class ASuperInitCall
                if parent != v.top_block and self != v.top_block then
                        v.error(self, "Error: Constructor invocation {property} must not be in nested block.")
                end
-               var cla = v.module[property.global.intro.local_class.global]
+               var cla = v.mmmodule[property.global.intro.local_class.global]
                var prev_class: nullable MMLocalClass = null
                var esic = v.explicit_super_init_calls.as(not null)
                if not esic.is_empty then