2
0
Sebastien Ros 11 жил өмнө
parent
commit
1a91f4b68f

+ 1 - 4
Jint/Native/Function/ScriptFunctionInstance.cs

@@ -1,6 +1,4 @@
-using System;
-using System.Linq;
-using Jint.Native.Argument;
+using System.Linq;
 using Jint.Native.Object;
 using Jint.Parser;
 using Jint.Runtime;
@@ -14,7 +12,6 @@ namespace Jint.Native.Function
     /// </summary>
     public sealed class ScriptFunctionInstance : FunctionInstance, IConstructor
     {
-        private readonly Engine Engine;
         private readonly IFunctionDeclaration _functionDeclaration;
 
         /// <summary>

+ 19 - 0
Jint/Native/JsValue.cs

@@ -351,6 +351,25 @@ namespace Jint.Native
                 }
             }
         }
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            return obj is JsValue && Equals((JsValue)obj);
+        }
+
+        public override int GetHashCode()
+        {
+            unchecked
+            {
+                var hashCode = _bool.GetHashCode();
+                hashCode = (hashCode * 397) ^ _double.GetHashCode();
+                hashCode = (hashCode * 397) ^ (_object != null ? _object.GetHashCode() : 0);
+                hashCode = (hashCode * 397) ^ (_string != null ? _string.GetHashCode() : 0);
+                hashCode = (hashCode * 397) ^ (int)_type;
+                return hashCode;
+            }
+        }
+
     }
 
     public static class Undefined

+ 0 - 2
Jint/Runtime/TypeConverter.cs

@@ -183,8 +183,6 @@ namespace Jint.Runtime
                 {
                     return double.NaN;
                 }
-
-                return double.NaN;
             }
 
             return ToNumber(ToPrimitive(o, Types.Number));