Browse Source

Implementing null literal

Sebastien Ros 12 years ago
parent
commit
287aa8de16
1 changed files with 3 additions and 6 deletions
  1. 3 6
      Jint/Runtime/ExpressionIntepreter.cs

+ 3 - 6
Jint/Runtime/ExpressionIntepreter.cs

@@ -264,12 +264,9 @@ namespace Jint.Runtime
 
         public object EvaluateIdentifier(Identifier identifier)
         {
-            switch (identifier.Name)
+            if (identifier.Name == "undefined")
             {
-                case "undefined":
-                    return Undefined.Instance;
-                case "null":
-                    return Null.Instance;
+                return Undefined.Instance;
             }
 
             return _engine.CurrentExecutionContext.LexicalEnvironment.GetIdentifierReference(identifier.Name, _engine.Options.IsStrict());
@@ -277,7 +274,7 @@ namespace Jint.Runtime
 
         public object EvaluateLiteral(Literal literal)
         {
-            return literal.Value;
+            return literal.Value ?? Null.Instance;
         }
 
         public object EvaluateObjectExpression(ObjectExpression objectExpression)