Author: sudha
Date: 2005-03-15 01:30:09 -0500 (Tue, 15 Mar 2005)
New Revision: 41825

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/expression.cs
   trunk/mcs/mbas/mb-parser.jay
Log:
Supported '\' operator



Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-03-15 05:43:56 UTC (rev 41824)
+++ trunk/mcs/mbas/ChangeLog    2005-03-15 06:30:09 UTC (rev 41825)
@@ -1,3 +1,8 @@
+2005-03-15 Satya Sudha K <[EMAIL PROTECTED]>
+       * mb-parser.jay :
+       * expression.cs :
+               Supported '\' (int division) operator
+
 2005-03-11 Manjula GHM <[EMAIL PROTECTED]>
            Sudharsan V <[EMAIL PROTECTED]>
           * mb-parser.jay:

Modified: trunk/mcs/mbas/expression.cs
===================================================================
--- trunk/mcs/mbas/expression.cs        2005-03-15 05:43:56 UTC (rev 41824)
+++ trunk/mcs/mbas/expression.cs        2005-03-15 06:30:09 UTC (rev 41825)
@@ -1772,7 +1772,7 @@
        public class Binary : Expression {
                public enum Operator : byte {
                        Exponentiation,
-                       Multiply, Division, Modulus,
+                       Multiply, Division, IntDivision, Modulus,
                        Addition, Subtraction,
                        LeftShift, RightShift,
                        LessThan, GreaterThan, LessThanOrEqual, 
GreaterThanOrEqual, 
@@ -1807,6 +1807,7 @@
 
                        oper_names [(int) Operator.Multiply] = "op_Multiply";
                        oper_names [(int) Operator.Division] = "op_Division";
+                       oper_names [(int) Operator.IntDivision] = "op_Division";
                        oper_names [(int) Operator.Modulus] = "op_Modulus";
                        oper_names [(int) Operator.Addition] = "op_Addition";
                        oper_names [(int) Operator.Subtraction] = 
"op_Subtraction";
@@ -1874,6 +1875,8 @@
                                return "*";
                        case Operator.Division:
                                return "/";
+                       case Operator.IntDivision:
+                               return "\\";
                        case Operator.Modulus:
                                return "Mod";
                        case Operator.Addition:
@@ -1977,6 +1980,14 @@
                                }
                        }
 
+                       if (oper == Operator.IntDivision) {
+                               if (l == TypeManager.decimal_type || r == 
TypeManager.decimal_type ||
+                                   l == TypeManager.float_type || r == 
TypeManager.float_type ||
+                                   l == TypeManager.double_type || r == 
TypeManager.double_type) 
+                                       conv_left_as = conv_right_as = 
TypeManager.int64_type;
+                                       l = r = TypeManager.int64_type;
+                       }
+
                        if (IsLogicalOperator (oper)) {
                                if (l == TypeManager.decimal_type)
                                        conv_left_as = TypeManager.bool_type;
@@ -2126,6 +2137,7 @@
                                oper == Operator.Subtraction || 
                                oper == Operator.Multiply ||    
                                oper == Operator.Division ||    
+                               oper == Operator.IntDivision || 
                                oper == Operator.Exponentiation ||      
                                oper == Operator.Modulus);
                }
@@ -2565,7 +2577,7 @@
                                                        fqn = 
"System.Decimal.Subtract";
                                                else if (oper == 
Operator.Multiply) 
                                                        fqn = 
"System.Decimal.Multiply";
-                                               else if (oper == 
Operator.Division) 
+                                               else if (oper == 
Operator.Division)
                                                        fqn = 
"System.Decimal.Divide";
                                                else if (oper == 
Operator.Modulus) 
                                                        fqn = 
"System.Decimal.Remainder";
@@ -2984,6 +2996,7 @@
                                break;
 
                        case Operator.Division:
+                       case Operator.IntDivision:
                                if (l == TypeManager.uint32_type || l == 
TypeManager.uint64_type)
                                        opcode = OpCodes.Div_Un;
                                else

Modified: trunk/mcs/mbas/mb-parser.jay
===================================================================
--- trunk/mcs/mbas/mb-parser.jay        2005-03-15 05:43:56 UTC (rev 41824)
+++ trunk/mcs/mbas/mb-parser.jay        2005-03-15 06:30:09 UTC (rev 41825)
@@ -4682,7 +4682,7 @@
        | integer_division_expression _mark_ OP_IDIV multiplicative_expression
           {
                //FIXME: Is this right ?
-               $$ = new Binary (Binary.Operator.Division,
+               $$ = new Binary (Binary.Operator.IntDivision,
                           (Expression) $1, (Expression) $4, (Location)$2);
           }
        | /*empty*/ _mark_ 

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

Reply via email to