From 63b8d8f94429608976507fe7fa75798b2c1e7ea4 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 12 Jun 2009 23:42:15 -0400 Subject: [PATCH] compile: clean CompilerVisitor constructor Signed-off-by: Jean Privat --- src/compiling/compiling.nit | 6 ++---- src/compiling/compiling_base.nit | 16 ++++++++++------ src/compiling/compiling_methods.nit | 5 ----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/compiling/compiling.nit b/src/compiling/compiling.nit index 5af27e8..7bfe046 100644 --- a/src/compiling/compiling.nit +++ b/src/compiling/compiling.nit @@ -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 ") 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 ") var native_name = filename.strip_extension(".nit") diff --git a/src/compiling/compiling_base.nit b/src/compiling/compiling_base.nit index 302705a..cdc9d6d 100644 --- a/src/compiling/compiling_base.nit +++ b/src/compiling/compiling_base.nit @@ -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 diff --git a/src/compiling/compiling_methods.nit b/src/compiling/compiling_methods.nit index f369f0e..856934e 100644 --- a/src/compiling/compiling_methods.nit +++ b/src/compiling/compiling_methods.nit @@ -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 -- 1.7.9.5