Author: manjula
Date: 2005-03-09 04:18:13 -0500 (Wed, 09 Mar 2005)
New Revision: 41588
Modified:
trunk/mcs/mbas/ChangeLog
trunk/mcs/mbas/expression.cs
trunk/mcs/mbas/mb-parser.jay
Log:
Support 'Is' Expression
Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog 2005-03-09 08:28:31 UTC (rev 41587)
+++ trunk/mcs/mbas/ChangeLog 2005-03-09 09:18:13 UTC (rev 41588)
@@ -1,3 +1,8 @@
+2005-03-09 Manjula GHM <[EMAIL PROTECTED]>
+ *mb-parser.jay :
+ *expression.cs :
+ Support 'Is' Expression
+
2005-03-08 Satya Sudha K <[EMAIL PROTECTED]>
* ecore.cs : Included Decimal -> Single/double conversions in
'WideningConversionExists' method
* expression.cs : Fixed the behaviour of some Unary operators
Modified: trunk/mcs/mbas/expression.cs
===================================================================
--- trunk/mcs/mbas/expression.cs 2005-03-09 08:28:31 UTC (rev 41587)
+++ trunk/mcs/mbas/expression.cs 2005-03-09 09:18:13 UTC (rev 41588)
@@ -1002,7 +1002,7 @@
public override Expression DoResolve (EmitContext ec)
{
- probe_type = ec.DeclSpace.ResolveType (ProbeType,
false, loc);
+ probe_type = ec.DeclSpace.ResolveType (ProbeType,
false, loc);
if (probe_type == null)
return null;
@@ -1013,6 +1013,7 @@
}
}
+
/// <summary>
/// Implementation of the 'is' operator.
/// </summary>
@@ -1115,6 +1116,7 @@
}
}
+
/// <summary>
/// Implementation of the 'as' operator.
/// </summary>
@@ -1771,6 +1773,7 @@
BitwiseOr,
LogicalAnd,
LogicalOr,
+ Is,
TOP
}
@@ -1811,6 +1814,7 @@
oper_names [(int) Operator.ExclusiveOr] =
"op_ExclusiveOr";
oper_names [(int) Operator.LogicalOr] = "op_LogicalOr";
oper_names [(int) Operator.LogicalAnd] =
"op_LogicalAnd";
+ oper_names [(int) Operator.Is] = "op_Is";
}
public Binary (Operator oper, Expression left, Expression
right, Location loc)
@@ -1893,6 +1897,8 @@
return "Or";
case Operator.LogicalAnd:
return "And";
+ case Operator.Is:
+ return "Is";
}
return oper.ToString ();
@@ -2162,7 +2168,9 @@
l = left.Type;
r = right.Type;
+
if (l == TypeManager.object_type && r ==
TypeManager.object_type) {
+
string fqn = null;
switch (oper) {
case Operator.Addition :
@@ -2206,6 +2214,11 @@
case Operator.RightShift:
fqn =
"ObjectType.ShiftRightObj";
break;
+ case Operator.Is:
+ eclass = ExprClass.Value;
+ type = TypeManager.bool_type;
+ return this;
+ break;
}
if (fqn == null) {
@@ -2675,7 +2688,8 @@
} else if (!(oper == Operator.LessThan ||
oper == Operator.GreaterThan ||
oper == Operator.LessThanOrEqual ||
- oper == Operator.GreaterThanOrEqual))
+ oper == Operator.GreaterThanOrEqual ||
+ oper == Operator.Is))
return false;
@@ -2753,6 +2767,13 @@
ig.Emit (OpCodes.Blt, target);
break;
+ case Operator.Is:
+ if (onTrue)
+ ig.Emit (OpCodes.Beq, target); //Check
this
+ else
+ ig.Emit (OpCodes.Bne_Un_S, target);
+ break;
+
default:
return false;
}
@@ -2882,6 +2903,7 @@
break;
case Operator.Equality:
+ case Operator.Is:
opcode = OpCodes.Ceq;
break;
Modified: trunk/mcs/mbas/mb-parser.jay
===================================================================
--- trunk/mcs/mbas/mb-parser.jay 2005-03-09 08:28:31 UTC (rev 41587)
+++ trunk/mcs/mbas/mb-parser.jay 2005-03-09 09:18:13 UTC (rev 41588)
@@ -4573,8 +4573,7 @@
}
| relational_expression IS shift_expression
{
- //FIXME: Should be a different op for reference equality but
allows tests to use Is
- $$ = new Binary (Binary.Operator.Equality,
+ $$ = new Binary (Binary.Operator.Is,
(Expression) $1, (Expression) $3,
lexer.Location);
}
| TYPEOF shift_expression IS type
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches