浏览代码

Implementing null literal

Sebastien Ros 12 年之前
父节点
当前提交
287aa8de16
共有 1 个文件被更改,包括 3 次插入6 次删除
  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)