From 545fed08c09aae1346c342a604adf8a464d05a6e Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 15 Jul 2009 11:28:30 -0400 Subject: [PATCH] compile: promote add_assignment and out_contexts Move them from compiling_methods to compiling_base. Signed-off-by: Jean Privat --- src/compiling/compiling_base.nit | 11 +++++++++++ src/compiling/compiling_methods.nit | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/compiling/compiling_base.nit b/src/compiling/compiling_base.nit index 4debc4f..f92e00b 100644 --- a/src/compiling/compiling_base.nit +++ b/src/compiling/compiling_base.nit @@ -56,6 +56,17 @@ class CompilerVisitor end end + # Add a assignment between a variable and an expression + fun add_assignment(v: String, s: String) + do + if v != s then + add_instr("{v} = {s};") + end + end + + # C outputs written outside the current C function. + readable writable var _out_contexts: Array[CContext] = new Array[CContext] + # Return a unique new number for the instance fun new_number: Int do diff --git a/src/compiling/compiling_methods.nit b/src/compiling/compiling_methods.nit index cf8b748..4233c68 100644 --- a/src/compiling/compiling_methods.nit +++ b/src/compiling/compiling_methods.nit @@ -59,21 +59,10 @@ redef class CompilerVisitor return v end - # Add a assignment between a variable and an expression - fun add_assignment(v: String, s: String) - do - if v != s then - add_instr("{v} = {s};") - end - end - readable writable var _cfc: nullable CFunctionContext readable writable var _nmc: nullable NitMethodContext - # C outputs written outside the current C function. - readable writable var _out_contexts: Array[CContext] = new Array[CContext] - # Generate an fprintf to display an error location fun printf_locate_error(node: PNode): String do -- 1.7.9.5