* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / Microsoft.JScript / Microsoft.JScript / Plus.cs
index 2b642ae163bea7efd03e1797e7c5112269bc1856..1088c1e811287e78d5b15c0773f726abbba091c6 100644 (file)
 //
 
 using System;
+using System.Diagnostics;
+using System.Globalization;
 
 namespace Microsoft.JScript {
 
        public sealed class Plus : BinaryOp {
 
                public Plus ()
+                       : base (null, null, null, JSToken.Plus, null)
                {
                }
 
-               public  object EvaluatePlus (object v1, object v2)
+               [DebuggerStepThroughAttribute]
+               [DebuggerHiddenAttribute]
+               public object EvaluatePlus (object v1, object v2)
                {
-                       if (v1 is String && v2 is String)
-                               return String.Concat (v1, v2);
+                       object val1 = Convert.ToPrimitive (v1, null);
+                       object val2 = Convert.ToPrimitive (v2, null);
+                       if (Convert.IsString (val1) || Convert.IsString (val2))
+                               return Convert.ToString (val1) + Convert.ToString (val2);
                        else
-                               return new object ();
+                               return Convert.ToNumber (val1) + Convert.ToNumber (val2);
                }
 
                public static object DoOp (object v1, object v2)
@@ -51,12 +58,12 @@ namespace Microsoft.JScript {
                        throw new NotImplementedException ();
                }
 
-               internal override bool Resolve (IdentificationTable context)
+               internal override bool Resolve (Environment env)
                {
                        throw new NotImplementedException ();
                }
 
-               internal override bool Resolve (IdentificationTable context, bool no_effect)
+               internal override bool Resolve (Environment env, bool no_effect)
                {
                        throw new NotImplementedException ();
                }