dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] cscctest/csharp/stmt foreach6.cs, NONE, 1.1 foreac


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] cscctest/csharp/stmt foreach6.cs, NONE, 1.1 foreach6.il, NONE, 1.1 foreach6.jl, NONE, 1.1 Makefile.am, 1.14, 1.15
Date: Tue, 14 Oct 2003 05:29:14 +0000

Update of /cvsroot/dotgnu-pnet/cscctest/csharp/stmt
In directory subversions:/tmp/cvs-serv789/csharp/stmt

Modified Files:
        Makefile.am 
Added Files:
        foreach6.cs foreach6.il foreach6.jl 
Log Message:


Add a test case for using "break" inside a "foreach" that needs
to perform cleanup.


--- NEW FILE: foreach6.jl ---
.assembly extern '.library'
{
        .ver 0:0:0:0
}
.assembly '<Assembly>'
{
        .ver 0:0:0:0
}
.module '<Module>'
.namespace 'System.Collections'
{
.class public auto interface abstract ansi 'IEnumerator'
{
.method public virtual hidebysig newslot abstract instance bool 'MoveNext'() 
cil managed java 
{
} // method MoveNext
.method public virtual hidebysig newslot abstract instance void 'Reset'() cil 
managed java 
{
} // method Reset
.method public virtual hidebysig newslot abstract specialname instance class 
['.library']'System'.'Object' 'get_Current'() cil managed java 
{
} // method get_Current
.property class ['.library']'System'.'Object' 'Current'()
{
        .get instance class ['.library']'System'.'Object' 
'System.Collections'.'IEnumerator'::'get_Current'()
} // property Current
} // class IEnumerator
} // namespace System.Collections
.namespace 'System.Collections'
{
.class public auto interface abstract ansi 'IEnumerable'
{
.method public virtual hidebysig newslot abstract instance class 
'System.Collections'.'IEnumerator' 'GetEnumerator'() cil managed java 
{
} // method GetEnumerator
} // class IEnumerable
} // namespace System.Collections
.class private auto ansi 'TestEnumerator' extends ['.library']'System'.'Object' 
implements 'System.Collections'.'IEnumerator'
{
.method private final virtual hidebysig newslot instance bool 
'System.Collections.IEnumerator.MoveNext'() cil managed java 
{
        .override       'System.Collections'.'IEnumerator'::'MoveNext'
        iconst_0
        ireturn
        .locals 1
        .maxstack 1
} // method System.Collections.IEnumerator.MoveNext
.method public hidebysig instance bool 'MoveNext'() cil managed java 
{
        iconst_0
        ireturn
        .locals 1
        .maxstack 1
} // method MoveNext
.method private final virtual hidebysig newslot instance void 
'System.Collections.IEnumerator.Reset'() cil managed java 
{
        .override       'System.Collections'.'IEnumerator'::'Reset'
        return
        .locals 1
        .maxstack 0
} // method System.Collections.IEnumerator.Reset
.method public hidebysig instance void 'Reset'() cil managed java 
{
        return
        .locals 1
        .maxstack 0
} // method Reset
.method private final virtual hidebysig newslot specialname instance class 
['.library']'System'.'Object' 'System.Collections.IEnumerator.get_Current'() 
cil managed java 
{
        .override       'System.Collections'.'IEnumerator'::'get_Current'
        iconst_0
        invokestatic    "System/Int32" "copyIn__" "(I)LSystem/Int32;"
        areturn
        .locals 1
        .maxstack 1
} // method System.Collections.IEnumerator.get_Current
.property class ['.library']'System'.'Object' 
'System.Collections.IEnumerator.Current'()
{
        .get instance class ['.library']'System'.'Object' 
'TestEnumerator'::'System.Collections.IEnumerator.get_Current'()
} // property System.Collections.IEnumerator.Current
.method public hidebysig specialname instance unsigned int8 'get_Current'() cil 
managed java 
{
        iconst_0
        sipush  255
        iand
        ireturn
        .locals 1
        .maxstack 2
} // method get_Current
.property unsigned int8 'Current'()
{
        .get instance unsigned int8 'TestEnumerator'::'get_Current'()
} // property Current
.method public hidebysig specialname rtspecialname instance void '.ctor'() cil 
managed java 
{
        aload_0
        invokespecial   instance void ['.library']'System'.'Object'::'.ctor'()
        return
        .locals 1
        .maxstack 1
} // method .ctor
} // class TestEnumerator
.class private sequential sealed serializable ansi 'TestEnumerable' extends 
['.library']'System'.'ValueType' implements 'System.Collections'.'IEnumerable'
{
.size 1
.method private final virtual hidebysig newslot instance class 
'System.Collections'.'IEnumerator' 
'System.Collections.IEnumerable.GetEnumerator'() cil managed java 
{
        .override       'System.Collections'.'IEnumerable'::'GetEnumerator'
        aconst_null
        areturn
        .locals 1
        .maxstack 1
} // method System.Collections.IEnumerable.GetEnumerator
.method public hidebysig instance class 'TestEnumerator' 'GetEnumerator'() cil 
managed java 
{
        aconst_null
        areturn
        .locals 1
        .maxstack 1
} // method GetEnumerator
} // class TestEnumerable
.class private auto ansi 'Test' extends ['.library']'System'.'Object'
{
.method private hidebysig instance int32 'm1'(valuetype 'TestEnumerable' 'en') 
cil managed java 
{
        ldc     ""
        invokestatic    "System/String" "__FromJavaString" 
"(Ljava/lang/String;)LSystem/String;"
        astore_2
        aload_1
        pop
        aconst_null
        invokespecial   instance class 'TestEnumerator' 
'TestEnumerable'::'GetEnumerator'()
        astore  4
        .try {
        goto    ?L1
        aload   4
        invokespecial   instance unsigned int8 'TestEnumerator'::'get_Current'()
        istore_3
        aload_2
        iload_3
        invokestatic    "System/Char" "ToString" "(C)LSystem/String;"
        invokestatic    "System/String" "Concat" 
"(LSystem/String;LSystem/String;)LSystem/String;"
        astore_2
        goto    ?L2
?L1:
        aload   4
        invokespecial   instance bool 'TestEnumerator'::'MoveNext'()
        ifne    ?L3
?L2:
        jsr     ?L4
        goto    ?L5
        }
        catch {
        astore  5
        jsr     ?L4
        aload   5
        athrow
        }
        finally {
        astore  6
        aload   4
        ifeq    ?L6
        aload   4
        invokeinterface "System/IDisposable" "Dispose" "()V" 1
?L6:
        ret     6
        }
?L5:
        iconst_0
        ireturn
        .locals 7
        .maxstack 2
} // method m1
.method public hidebysig specialname rtspecialname instance void '.ctor'() cil 
managed java 
{
        aload_0
        invokespecial   instance void ['.library']'System'.'Object'::'.ctor'()
        return
        .locals 1
        .maxstack 1
} // method .ctor
} // class Test

--- NEW FILE: foreach6.il ---
.assembly extern '.library'
{
        .ver 0:0:0:0
}
.assembly '<Assembly>'
{
        .ver 0:0:0:0
}
.module '<Module>'
.namespace 'System.Collections'
{
.class public auto interface abstract ansi 'IEnumerator'
{
.method public virtual hidebysig newslot abstract instance bool 'MoveNext'() 
cil managed 
{
} // method MoveNext
.method public virtual hidebysig newslot abstract instance void 'Reset'() cil 
managed 
{
} // method Reset
.method public virtual hidebysig newslot abstract specialname instance class 
['.library']'System'.'Object' 'get_Current'() cil managed 
{
} // method get_Current
.property class ['.library']'System'.'Object' 'Current'()
{
        .get instance class ['.library']'System'.'Object' 
'System.Collections'.'IEnumerator'::'get_Current'()
} // property Current
} // class IEnumerator
} // namespace System.Collections
.namespace 'System.Collections'
{
.class public auto interface abstract ansi 'IEnumerable'
{
.method public virtual hidebysig newslot abstract instance class 
'System.Collections'.'IEnumerator' 'GetEnumerator'() cil managed 
{
} // method GetEnumerator
} // class IEnumerable
} // namespace System.Collections
.class private auto ansi 'TestEnumerator' extends ['.library']'System'.'Object' 
implements 'System.Collections'.'IEnumerator'
{
.method private final virtual hidebysig newslot instance bool 
'System.Collections.IEnumerator.MoveNext'() cil managed 
{
        .override       'System.Collections'.'IEnumerator'::'MoveNext'
        ldc.i4.0
        ret
        .maxstack 1
} // method System.Collections.IEnumerator.MoveNext
.method public hidebysig instance bool 'MoveNext'() cil managed 
{
        ldc.i4.0
        ret
        .maxstack 1
} // method MoveNext
.method private final virtual hidebysig newslot instance void 
'System.Collections.IEnumerator.Reset'() cil managed 
{
        .override       'System.Collections'.'IEnumerator'::'Reset'
        ret
        .maxstack 0
} // method System.Collections.IEnumerator.Reset
.method public hidebysig instance void 'Reset'() cil managed 
{
        ret
        .maxstack 0
} // method Reset
.method private final virtual hidebysig newslot specialname instance class 
['.library']'System'.'Object' 'System.Collections.IEnumerator.get_Current'() 
cil managed 
{
        .override       'System.Collections'.'IEnumerator'::'get_Current'
        ldc.i4.0
        box     ['.library']'System'.'Int32'
        ret
        .maxstack 1
} // method System.Collections.IEnumerator.get_Current
.property class ['.library']'System'.'Object' 
'System.Collections.IEnumerator.Current'()
{
        .get instance class ['.library']'System'.'Object' 
'TestEnumerator'::'System.Collections.IEnumerator.get_Current'()
} // property System.Collections.IEnumerator.Current
.method public hidebysig specialname instance unsigned int8 'get_Current'() cil 
managed 
{
        ldc.i4.0
        conv.u1
        ret
        .maxstack 1
} // method get_Current
.property unsigned int8 'Current'()
{
        .get instance unsigned int8 'TestEnumerator'::'get_Current'()
} // property Current
.method public hidebysig specialname rtspecialname instance void '.ctor'() cil 
managed 
{
        ldarg.0
        call    instance void ['.library']'System'.'Object'::'.ctor'()
        ret
        .maxstack 1
} // method .ctor
} // class TestEnumerator
.class private sequential sealed serializable ansi 'TestEnumerable' extends 
['.library']'System'.'ValueType' implements 'System.Collections'.'IEnumerable'
{
.size 1
.method private final virtual hidebysig newslot instance class 
'System.Collections'.'IEnumerator' 
'System.Collections.IEnumerable.GetEnumerator'() cil managed 
{
        .override       'System.Collections'.'IEnumerable'::'GetEnumerator'
        ldnull
        ret
        .maxstack 1
} // method System.Collections.IEnumerable.GetEnumerator
.method public hidebysig instance class 'TestEnumerator' 'GetEnumerator'() cil 
managed 
{
        ldnull
        ret
        .maxstack 1
} // method GetEnumerator
} // class TestEnumerable
.class private auto ansi 'Test' extends ['.library']'System'.'Object'
{
.method private hidebysig instance int32 'm1'(valuetype 'TestEnumerable' 'en') 
cil managed 
{
        .locals init    (class ['.library']'System'.'String', char)
        ldstr   ""
        stloc.0
        .locals init    (class 'TestEnumerator')
        .locals init    (class ['.library']'System'.'IDisposable')
        ldarga.s        1
        call    instance class 'TestEnumerator' 
'TestEnumerable'::'GetEnumerator'()
        stloc.2
        .try {
        br      ?L1
?L2:
        ldloc.2
        call    instance unsigned int8 'TestEnumerator'::'get_Current'()
        stloc.1
        ldloc.0
        ldloc.1
        call    class [.library]System.String 
[.library]System.Char::ToString(char)
        call    class [.library]System.String 
[.library]System.String::Concat(class [.library]System.String, class 
[.library]System.String)
        stloc.0
        leave   ?L3
?L1:
        ldloc.2
        call    instance bool 'TestEnumerator'::'MoveNext'()
        brtrue  ?L2
?L4:
        leave   ?L3
        }
        finally {
        ldloc.2
        isinst  [.library]System.IDisposable
        stloc.3
        ldloc.3
        brfalse ?L5
        ldloc.3
        callvirt        instance void [.library]System.IDisposable::Dispose()
?L5:
        endfinally
        }
?L3:
        ldc.i4.0
        ret
        .maxstack 2
} // method m1
.method public hidebysig specialname rtspecialname instance void '.ctor'() cil 
managed 
{
        ldarg.0
        call    instance void ['.library']'System'.'Object'::'.ctor'()
        ret
        .maxstack 1
} // method .ctor
} // class Test

--- NEW FILE: foreach6.cs ---
/*
 * foreach5.cs - Test the handling of "foreach" statements for Collections.
 *
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
namespace System.Collections
{
public interface IEnumerator
{
        bool MoveNext();
        void Reset();
        Object Current { get; }
}

public interface IEnumerable
{
        IEnumerator GetEnumerator();
}
}
using System.Collections;
class TestEnumerator: IEnumerator
{
        bool IEnumerator.MoveNext()
        {
                return false;
        }
        public bool MoveNext()
        {
                return false;
        }
        void IEnumerator.Reset()
        {
        }
        public void Reset()
        {
        }
        Object IEnumerator.Current
        {
                get
                {
                        return 0;
                }
        }
        public byte Current
        {
                get
                {
                        return 0;
                }
        }
}

struct TestEnumerable: IEnumerable
{
        IEnumerator IEnumerable.GetEnumerator()
        {
                return null;            
        }
        public TestEnumerator GetEnumerator()
        {
                return null;            
        }
}

class Test
{
        int m1(TestEnumerable en)
        {
                String y="";
                foreach(char x in en)
                {
                        y=y+x;
                        break;          // should use "leave", not "br"
                }
                return 0;
        }
}

Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/csharp/stmt/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Makefile.am 9 Dec 2002 23:39:22 -0000       1.14
--- Makefile.am 14 Oct 2003 05:29:12 -0000      1.15
***************
*** 7,10 ****
--- 7,11 ----
                foreach4.cs \
                foreach5.cs \
+               foreach6.cs \
                locals1.cs \
                locals2.cs \





reply via email to

[Prev in Thread] Current Thread [Next in Thread]