Author: toshok
Date: 2005-05-08 14:44:24 -0400 (Sun, 08 May 2005)
New Revision: 44221

Modified:
   trunk/debugger/backends/mono/MonoClassObject.cs
   trunk/debugger/frontend/Expression.cs
Log:
2005-05-08  Chris Toshok  <[EMAIL PROTECTED]>

        * backends/mono/MonoClassObject.cs (MonoClassObject.PrintObjcet):
        fix unitialized use of "func".

        * frontend/Expression.cs
        (MemberAccessExpression.ResolveMemberAccess): try to resolve left
        as a regular expression first, falling back to treating it as a
        type if that fails (reverse the way the code worked previously).
        This allows things like "print foo.a" when you've defined foo as
        "struct foo foo" in C.  This also points out that type names (in C
        at least), should include the "struct ".



Modified: trunk/debugger/backends/mono/MonoClassObject.cs
===================================================================
--- trunk/debugger/backends/mono/MonoClassObject.cs     2005-05-08 18:17:32 UTC 
(rev 44220)
+++ trunk/debugger/backends/mono/MonoClassObject.cs     2005-05-08 18:44:24 UTC 
(rev 44221)
@@ -54,7 +54,7 @@
                public string PrintObject ()
                {
                        ITargetObject[] args = new ITargetObject[0];
-                       ITargetFunctionObject func;
+                       ITargetFunctionObject func = null;
                        ITargetStructType stype = (ITargetStructType)type.Type;
 
                again:

Modified: trunk/debugger/frontend/Expression.cs
===================================================================
--- trunk/debugger/frontend/Expression.cs       2005-05-08 18:17:32 UTC (rev 
44220)
+++ trunk/debugger/frontend/Expression.cs       2005-05-08 18:44:24 UTC (rev 
44221)
@@ -147,7 +147,7 @@
                        bool ok = DoAssign (context, obj);
                        if (!ok)
                                throw new ScriptingException (
-                                       "Expression `{0}' is not an lvalue", 
Name);
+                                       "Expression `{0}' ({1}) is not an 
lvalue", Name, this);
                }
 
                protected virtual Expression DoResolveType (ScriptingContext 
context)
@@ -679,8 +679,25 @@
                public Expression ResolveMemberAccess (ScriptingContext 
context, bool allow_instance)
                {
                        StackFrame frame = context.CurrentFrame.Frame;
+                       Expression expr;
 
-                       Expression expr;
+                       Expression lexpr = left.TryResolve (context);
+                       if (lexpr != null) {
+                               ITargetStructObject sobj = 
lexpr.EvaluateVariable (context) as ITargetStructObject;
+                               if (sobj == null)
+                                       throw new ScriptingException (
+                                               "`{0}' is not a struct or 
class", left.Name);
+
+                               expr = StructAccessExpression.FindMember (
+                                               sobj.Type, frame, sobj, true, 
name);
+                               if (expr == null)
+                                       throw new ScriptingException (
+                                               "Type `{0}' has no member 
`{1}'",
+                                               sobj.Type.Name, name);
+
+                               return expr;
+                       }
+
                        Expression ltype = left.TryResolveType (context);
                        if (ltype != null) {
                                ITargetStructType stype = ltype.EvaluateType 
(context)
@@ -699,25 +716,8 @@
                                return expr;
                        }
 
-                       Expression lexpr = left.TryResolve (context);
-                       if (lexpr == null)
-                               throw new ScriptingException (
-                                       "No such variable or type: `{0}'", 
left.Name);
-
-                       ITargetStructObject sobj = lexpr.EvaluateVariable 
(context)
-                               as ITargetStructObject;
-                       if (sobj == null)
-                               throw new ScriptingException (
-                                       "`{0}' is not a struct or class", 
left.Name);
-
-                       expr = StructAccessExpression.FindMember (
-                               sobj.Type, frame, sobj, true, name);
-                       if (expr == null)
-                               throw new ScriptingException (
-                                       "Type `{0}' has no member `{1}'",
-                                       sobj.Type.Name, name);
-
-                       return expr;
+                       throw new ScriptingException (
+                               "No such variable or type: `{0}'", left.Name);
                }
 
                protected override Expression DoResolve (ScriptingContext 
context)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to