* expression.cs: emit unary operator code.
* TypeOf.cs: back to Microsoft.JScript namespace. fix typo.
* Literal.cs: constrain more the case of negative numeric literal.
svn path=/trunk/mcs/; revision=35868
2004-11-08 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+ * expression.cs: emit unary operator code.
+ * TypeOf.cs: back to Microsoft.JScript namespace. fix typo.
+ * Literal.cs: constrain more the case of negative numeric literal.
+
* expression.cs (emit_func_call): pop if function's return type is
non-void and has no effect.
internal override void Emit (EmitContext ec)
{
ILGenerator ig = ec.ig;
- if (parent is Unary) {
- Unary tmp = parent as Unary;
- if (tmp.oper == JSToken.Minus)
- ig.Emit (OpCodes.Ldc_R8, (double) (val * -1));
- } else
+ if (parent is Unary && (parent as Unary).oper == JSToken.Minus)
+ ig.Emit (OpCodes.Ldc_R8, (double) (val * -1));
+ else
ig.Emit (OpCodes.Ldc_R8, (double) val);
ig.Emit (OpCodes.Box, typeof (System.Double));
if (no_effect)
using System;
-namespace Microsoft.JScript.Tmp {
+namespace Microsoft.JScript {
- public sealed class TypeOf : UnaryOp {
+ public sealed class Typeof : UnaryOp {
- public static string JScriptTypeOf (object value)
+ public static string JScriptTypeof (object value)
{
throw new NotImplementedException ();
}
internal override void Emit (EmitContext ec)
{
if (operand != null)
- operand.Emit (ec);
- }
+ operand.Emit (ec);
+ if (oper != JSToken.Minus)
+ emit_unary_op (ec);
+ }
+
+ internal void emit_unary_op (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ switch (oper) {
+ case JSToken.Typeof:
+ ig.Emit (OpCodes.Call, typeof (Typeof).GetMethod ("JScriptTypeof"));
+ break;
+ }
+ }
}
internal class Binary : BinaryOp, IAssignable {