2005-10-07 Maverson Eduardo Schulze Rosa <maverson@gmail.com>
authorAlexandre Rocha Lima e Marcondes <alexandre@mono-cvs.ximian.com>
Fri, 7 Oct 2005 20:14:38 +0000 (20:14 -0000)
committerAlexandre Rocha Lima e Marcondes <alexandre@mono-cvs.ximian.com>
Fri, 7 Oct 2005 20:14:38 +0000 (20:14 -0000)
           Alexandre Rocha Lima e Marcondes <alexandre@psl-pr.softwarelivre.org>
           Rafael Teixeira <rafaelteixeirabr@hotmail.com>

       * block.cs, statements.cs, expression.cs: Fix ForEach when iterating fields
       * Some Test fixes

svn path=/trunk/mcs/; revision=51431

mcs/mbas/ChangeLog
mcs/mbas/Test/tests/statements/ForEachB.vb
mcs/mbas/Test/tests/statements/ForEachC.vb
mcs/mbas/block.cs
mcs/mbas/expression.cs
mcs/mbas/statement.cs

index 5d5149cdb74b42dd6deb52eff32a7383e24de2f6..a5b8c85f21f76aecfb34e618ff6fea0bf91994f0 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-07 Maverson Eduardo Schulze Rosa <maverson@gmail.com>
+           Alexandre Rocha Lima e Marcondes <alexandre@psl-pr.softwarelivre.org>       
+           Rafael Teixeira <rafaelteixeirabr@hotmail.com>  
+           
+       * block.cs, statements.cs, expression.cs: Fix ForEach when iterating fields
+       
 2005-10-05 Aldo Monteiro <aldo@psl-pr.softwarelivre.org>
  
        * ecore.cs : Created a public property (Id) to access externally the field
@@ -8,7 +14,7 @@
 
 2005-09-26 Maverson Eduardo Schulze Rosa <maverson@gmail.com>
            Alexandre Rocha Lima e Marcondes <alexandre@psl-pr.softwarelivre.org>       
-       * mb-parser.jay: Fix For Each when using fields as the variable used
+       * mb-parser.jay: Fix ForEach when using fields as the variable used
        to iterate through the elements.
        * expression.cs: Created new LocalVariableReference EmitAssign used in
        for each with non Static fields.
index 43fc17e8d0c6c5341be647ef8d0992bd5fb05331..ff98107588697225fbbbe48096cb2f8e308317fd 100644 (file)
@@ -8,7 +8,6 @@ Module ForEachB
         Sub New()
             Dim arr() As Integer = {1, 2, 3}
             For Each index In arr
-                Console.WriteLine(index)
             Next
         End Sub
 
@@ -21,4 +20,4 @@ Module ForEachB
         End If
     End Sub
 
-End Module
\ No newline at end of file
+End Module
index 3d94e8b5b70992cd44d790d71e47da5dc36aa871..4f11a4b1c15f94452321142b2329e8414fa1e364 100644 (file)
@@ -26,7 +26,7 @@ Module ForEachC
 
     Sub main()
         Dim c As New C1()
-        If c.index <> "c" Then
+        If not c.index.Equals("c") Then
             Throw New Exception("#FEC1")
         End If
     End Sub
index ed3186c27c5fa0fe3acd669ee75a2604572996e1..3c3955faa27cf4ed9a233ce20d882a15b411b6b1 100644 (file)
@@ -709,9 +709,10 @@ namespace Mono.MonoBASIC {
                                        if (vi.VariableType == null)
                                                continue;
 
-                                       vi.LocalBuilder = ig.DeclareLocal (vi.VariableType);
+                                       if (vi.Alias == null)
+                                               vi.LocalBuilder = ig.DeclareLocal (vi.VariableType);
 
-                                       if (CodeGen.SymbolWriter != null)
+                                       if (CodeGen.SymbolWriter != null && vi.LocalBuilder != null)
                                                vi.LocalBuilder.SetLocalSymInfo (name);
 
                                        if (constants == null)
index 9879f7caf29b70831bf6262ebed557068347cbfa..0552405f829cfc6930c4623ed6a1dab3565dddbb 100644 (file)
@@ -3367,7 +3367,7 @@ namespace Mono.MonoBASIC {
                                                break;
                                        }
                                }
-                               Console.WriteLine("teste Maverson");
+                               
                                if ((fb.ModFlags & Modifiers.STATIC) != 0) {
                                        source.Emit (ec);
                                        ig.Emit (OpCodes.Stsfld, fb.FieldBuilder);
@@ -3390,9 +3390,8 @@ namespace Mono.MonoBASIC {
                        //part of source assign emmited before this.
                        ILGenerator ig = ec.ig;
                        VariableInfo vi = VariableInfo;
-
+                       
                        vi.Assigned = true;
-
                        source.Emit (ec);
                        if ((fb.ModFlags & Modifiers.STATIC) != 0) 
                                ig.Emit (OpCodes.Stsfld, fb.FieldBuilder);
index c955d8f59853f80680f9075cb9b4a120be0b3aed..95e97749c7f1ee4af3af4be2dbc616b7cbcf8253 100644 (file)
@@ -4792,6 +4792,19 @@ namespace Mono.MonoBASIC {
                        if (expr == null)
                                return false;
 
+                       if ( variable.VariableInfo.Alias != null )
+                       {
+                               FieldBase fb = variable.VariableInfo.GetFieldAlias(ec);
+
+                               if ( fb == null )
+                               {
+                                       Report.Error (451, loc,"Name '" + variable.VariableInfo.Name  + "' is not declared.");
+                                       return false;
+                               }
+                               else
+                               type = fb.Type;
+                       }
+                                               
                        var_type = ec.DeclSpace.ResolveType (type, false, loc);
                        if (var_type == null)
                                return false;
@@ -4809,15 +4822,6 @@ namespace Mono.MonoBASIC {
                                return false;
                        }
 
-                       if ( variable.VariableInfo.Alias != null )
-                       {
-                               if ( variable.VariableInfo.GetFieldAlias(ec) == null )
-                               {
-                                       Report.Error (451, loc,"Name '" + variable.VariableInfo.Name  + "' is not declared.");  
-                                       return false;
-                               }
-                       }
-
                        if (expr.Type.IsArray) {
                                array_type = expr.Type;
                                element_type = array_type.GetElementType ();