compile: clean CompilerVisitor constructor
authorJean Privat <jean@pryen.org>
Sat, 13 Jun 2009 03:42:15 +0000 (23:42 -0400)
committerJean Privat <jean@pryen.org>
Wed, 24 Jun 2009 19:47:32 +0000 (15:47 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/compiling/compiling.nit
src/compiling/compiling_base.nit
src/compiling/compiling_methods.nit

index 5af27e8..7bfe046 100644 (file)
@@ -80,8 +80,7 @@ redef class MMSrcModule
        # Compile the main file
        private meth compile_main(tc: ToolContext, ga: GlobalAnalysis)
        do
-               var v = new CompilerVisitor(self)
-               v.tc = tc
+               var v = new CompilerVisitor(self, tc)
                v.global_analysis = ga
                v.add_decl("#include <nit_common.h>")
                compile_tables_to_c(v)
@@ -98,8 +97,7 @@ redef class MMSrcModule
        # Compile the sep files (of the current module only)
        private meth compile_separate_module(tc: ToolContext, ga: GlobalAnalysis)
        do
-               var v = new CompilerVisitor(self)
-               v.tc = tc
+               var v = new CompilerVisitor(self, tc)
                v.global_analysis = ga
                v.add_decl("#include <nit_common.h>")
                var native_name = filename.strip_extension(".nit")
index 302705a..cdc9d6d 100644 (file)
@@ -86,20 +86,24 @@ class CompilerVisitor
                return out.join("\n")
        end
 
-       # The current module processed
-       readable writable attr _module: MMSrcModule 
+       # The processed module
+       readable attr _module: MMSrcModule
 
        # Where instr and decl are stored
        readable writable attr _ctx: CContext = new CContext
 
        # The current indent lever
-       readable writable attr _indent_level: Int = 0 
+       readable writable attr _indent_level: Int = 0
 
-       # The current ToolContext
-       readable writable attr _tc: ToolContext 
+       # The ToolContext info
+       readable attr _tc: ToolContext
 
        # Create a new CompilerVisitor based on a module
-       init(module: MMSrcModule) do _module = module
+       init(module: MMSrcModule, tc: ToolContext)
+       do
+               _module = module
+               _tc = tc
+       end
 end
 
 # Where instr and decl are stored for a module
index f369f0e..856934e 100644 (file)
@@ -85,11 +85,6 @@ redef class CompilerVisitor
                return s.to_s
        end
 
-       redef init(module: MMSrcModule)
-       do
-               super
-       end
-
        meth invoke_super_init_calls_after(start_prop: MMMethod)
        do
                var n = nmc.method.node