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

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

[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_invoke.tc,1.21,1.22


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_invoke.tc,1.21,1.22
Date: Sun, 08 Dec 2002 08:17:58 -0500

Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv14361/cscc/csharp

Modified Files:
        cs_invoke.tc 
Log Message:
instance access checks for delegate creation 


Index: cs_invoke.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_invoke.tc,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** cs_invoke.tc        4 Dec 2002 21:59:04 -0000       1.21
--- cs_invoke.tc        8 Dec 2002 13:17:56 -0000       1.22
***************
*** 573,577 ****
--- 573,579 ----
        ILProgramItem *itemInfo;
        ILMethod *firstMatch;
+       ILNode_MethodDeclaration *caller;
        ILNode *newExpr;
+       ILNode *thisExpr;
  
        /* The result is an r-value of type "delegateType" */
***************
*** 625,628 ****
--- 627,648 ----
        else
        {
+               if(yyisa(newExpr,ILNode_Argument))
+               {
+                       thisExpr=((ILNode_Argument*)(newExpr))->expression;
+                       if(yyisa(thisExpr, ILNode_This) ||
+                         (yyisa(thisExpr, ILNode_MarkType) &&
+                          yyisa(((ILNode_MarkType *)(thisExpr))->expr, 
ILNode_This)))
+                       {
+                               caller = (ILNode_MethodDeclaration 
*)(info->currentMethod);
+                               if(!caller || 
+                                       (caller->modifiers & 
IL_META_METHODDEF_STATIC) != 0)
+                               {
+                                       /* Attempt to call an instance method 
using "this"
+                                          from within a static method */
+                                       CCErrorOnLine(yygetfilename(newExpr), 
yygetlinenum(newExpr),
+                                                 "cannot access instance 
members in static methods");
+                               }
+                       }
+               }
                *parent = ILNode_DelegateCreationExpression_create
                        (ILType_ToClass(delegateType), newExpr, firstMatch);




reply via email to

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