syntax: remove local variable masking
[nit.git] / src / syntax / icode_generation.nit
index b87f91c..b48ede4 100644 (file)
@@ -115,17 +115,17 @@ special ICodeBuilder
                end
                var l = n.super_init_calls.length
                while i < l do
-                       var p = n.super_init_calls[i]
-                       if p == stop_prop then break
+                       var sp = n.super_init_calls[i]
+                       if sp == stop_prop then break
                        var cargs = new Array[IRegister]
-                       if p.signature.arity == 0 then
+                       if sp.signature.arity == 0 then
                                cargs.add(iroutine.params.first)
                        else
                                for va in iroutine.params do
                                        cargs.add(va)
                                end
                        end
-                       stmt(new ICall(p, cargs))
+                       stmt(new ICall(sp, cargs))
                        i += 1
                end
        end
@@ -314,7 +314,7 @@ redef class AMethPropdef
 end
 
 redef class ASignature
-       fun fill_iroutine_parameters(v: A2IContext, orig_sig: MMSignature, params: IndexedCollection[IRegister], closdecls: nullable IndexedCollection[IClosureDecl])
+       fun fill_iroutine_parameters(v: A2IContext, orig_sig: MMSignature, params: Sequence[IRegister], closdecls: nullable Sequence[IClosureDecl])
        do
                for ap in n_params do
                        var reg = v.variable(ap.variable)
@@ -738,6 +738,29 @@ redef class AWhileExpr
        end
 end
 
+redef class ALoopExpr
+       redef fun generate_icode(v)
+       do
+               var seq_old = v.seq
+               var iloop = new ILoop
+               v.stmt(iloop)
+               escapable.break_seq = iloop
+               v.seq = iloop
+
+               # Process inside
+               if n_block != null then
+                       var seq = new ISeq
+                       v.stmt(seq)
+                       v.seq = seq
+                       escapable.continue_seq = seq
+                       v.generate_stmt(n_block)
+               end
+
+               v.seq = seq_old
+               return null
+       end
+end
+
 redef class AForExpr
        redef fun generate_icode(v)
        do
@@ -1137,7 +1160,7 @@ redef class ASuperExpr
                                return null
                        end
                else
-                       var p = prop
+                       p = prop
                        var rtype = p.signature.return_type
                        if rtype == null then
                                v.stmt(new ISuper(p, args))