From: Jean Privat Date: Mon, 10 Aug 2009 14:25:58 +0000 (-0400) Subject: icode: remove method info from ICodeBuilder X-Git-Tag: v0.3~71 X-Git-Url: http://nitlanguage.org icode: remove method info from ICodeBuilder Signed-off-by: Jean Privat --- diff --git a/src/compiling/compiling_global.nit b/src/compiling/compiling_global.nit index 9314b9a..745a523 100644 --- a/src/compiling/compiling_global.nit +++ b/src/compiling/compiling_global.nit @@ -869,7 +869,7 @@ redef class MMLocalClass var iself = new IRegister(get_type) var iselfa = [iself] var iroutine = new IRoutine(new Array[IRegister], iself) - var icb = new ICodeBuilder(module, iroutine, null) + var icb = new ICodeBuilder(module, iroutine) var obj = new INative("OBJ2VAL(obj)", null) obj.result = iself icb.stmt(obj) @@ -906,7 +906,7 @@ redef class MMLocalClass var iself = new IRegister(get_type) var iselfa = [iself] var iroutine = new IRoutine(iselfa, null) - var icb = new ICodeBuilder(module, iroutine, null) + var icb = new ICodeBuilder(module, iroutine) for g in global_properties do var p = self[g] var t = p.signature.return_type @@ -939,7 +939,7 @@ redef class MMLocalClass 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, p) + var icb = new ICodeBuilder(module, iroutine) var inew = new INative("NEW_{name}()", null) inew.result = iself diff --git a/src/icode/icode_builder.nit b/src/icode/icode_builder.nit index ac9a9d5..2d75813 100644 --- a/src/icode/icode_builder.nit +++ b/src/icode/icode_builder.nit @@ -196,16 +196,12 @@ class ICodeBuilder # The current sequence of icodes readable writable var _seq: ISeq - # The method associated to the iroutine (if any) - readable var _method: nullable MMMethod - - init(module: MMModule, r: IRoutine, m: nullable MMMethod) + init(module: MMModule, r: IRoutine) do _module = module _current_location = r.location _iroutine = r _seq = r.body - _method = m end # New ICodes are set to this location diff --git a/src/syntax/icode_generation.nit b/src/syntax/icode_generation.nit index b48ede4..cdceefc 100644 --- a/src/syntax/icode_generation.nit +++ b/src/syntax/icode_generation.nit @@ -79,12 +79,16 @@ special ICodeBuilder # Register where a functionnal nit return must store its value readable writable var _return_value: nullable IRegister + # The method associated to the iroutine (if any) + readable var _method: nullable MMMethod + init(visitor: AbsSyntaxVisitor, r: IRoutine, m: nullable MMMethod) do - super(visitor.module, r, m) + super(visitor.module, r) _visitor = visitor _return_seq = r.body _return_value = r.result + _method = m end # Insert implicit super init calls