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_lvalue.tc,1.39,1.40


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_lvalue.tc,1.39,1.40
Date: Sun, 09 Mar 2003 09:41:37 -0500

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

Modified Files:
        cs_lvalue.tc 
Log Message:
allow readonly variables to be initialized (what else are they for ?)


Index: cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** cs_lvalue.tc        27 Feb 2003 03:21:24 -0000      1.39
--- cs_lvalue.tc        9 Mar 2003 14:41:35 -0000       1.40
***************
*** 463,466 ****
--- 463,481 ----
  
  /*
+  * Check if the method is the psuedo method ".init" which is expanded
+  * into the constructor body inline.
+  */
+ static int ILMethodIsPsuedoConstructor(ILMethod *method)
+ {
+       ILType *signature=ILMethod_Signature(method);
+       ILUInt32 attrs= (IL_META_METHODDEF_PRIVATE| 
IL_META_METHODDEF_HIDE_BY_SIG);
+ 
+       return (!strcmp(ILMethod_Name(method),".init") && 
+                       ((ILMethod_Attrs(method) & attrs) !=0) &&
+                       (ILTypeNumParams(signature)==0) &&
+                       
ILTypeIdentical(ILTypeGetReturn(signature),ILType_Void));
+ }
+ 
+ /*
   * Convert a semantic value into an l-value or r-value if necessary.
   */
***************
*** 520,531 ****
                                        }
                                        else if(!ILField_IsStatic(field) &&
!                                               ILMethodIsConstructor(method))
                                        {
!                                               /* Instance readonly used 
within instance constructor.
                                                   Nothing needs to be done 
here */
                                        }
                                        else
                                        {
!                                               /* The field is used elsewhere, 
so make it an r-value */
                                                CSSemSetRValue(value, 
ILField_Type(field));
                                        }
--- 535,549 ----
                                        }
                                        else if(!ILField_IsStatic(field) &&
!                                               (ILMethodIsConstructor(method)||
!                                                       
ILMethodIsPsuedoConstructor(method)))
                                        {
!                                               /* Instance readonly used 
within instance constructor
!                                                  or the ".init" psuedo 
constructor
                                                   Nothing needs to be done 
here */
                                        }
                                        else
                                        {
!                                               /* The field is used elsewhere, 
so make it an 
!                                               r-value */
                                                CSSemSetRValue(value, 
ILField_Type(field));
                                        }





reply via email to

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