Browse Source

Fixing Benchmark

Sebastien Ros 11 years ago
parent
commit
c962996008

+ 1 - 0
Jint/Native/JsValue.cs

@@ -122,6 +122,7 @@ namespace Jint.Native
             return _object;
         }
 
+        [Pure]
         public T TryCast<T>(Action<JsValue> fail = null) where T: class
         {
             if (!this.IsObject())

+ 1 - 1
Jint/Runtime/ExpressionIntepreter.cs

@@ -800,7 +800,7 @@ namespace Jint.Runtime
                 throw new JavaScriptException(_engine.TypeError);
             }
 
-            if (func.IsObject())
+            if (!func.IsObject())
             {
                 throw new JavaScriptException(_engine.TypeError);
             }

+ 2 - 1
Jint/Runtime/References/Reference.cs

@@ -1,4 +1,5 @@
 using Jint.Native;
+using Jint.Runtime.Environments;
 
 namespace Jint.Runtime.References
 {
@@ -47,7 +48,7 @@ namespace Jint.Runtime.References
         public bool IsPropertyReference()
         {
             // http://www.ecma-international.org/ecma-262/5.1/#sec-8.7
-            return _baseValue.IsObject() || HasPrimitiveBase();
+            return (_baseValue.IsObject() && _baseValue.TryCast<EnvironmentRecord>() == null) || HasPrimitiveBase();
         }
     }
 }