소스 검색

Simplying Strict support

Sebastien Ros 8 년 전
부모
커밋
52fe4e9f8e

+ 2 - 1
Jint.Tests.Ecma/project.json

@@ -6,6 +6,7 @@
     "xunit": "2.2.0-*",
     "dotnet-test-xunit": "2.2.0-preview2-build1029"
   },
+  "buildOptions": {"compile": {"exclude": "TestCases"}},
   "frameworks": {
     "netcoreapp1.0": {
       "dependencies": {
@@ -16,7 +17,7 @@
       }
     },
     "net451": {
-      "buildOptions": { }
+      "buildOptions": {}
     }
   }
 }

+ 1 - 1
Jint/Engine.cs

@@ -316,7 +316,7 @@ namespace Jint
             ResetLastStatement();
             ResetCallStack();
 
-            using (new StrictModeScope(Options._IsStrict || program.IsStrict()))
+            using (new StrictModeScope(Options._IsStrict || program.Strict))
             {
                 DeclarationBindingInstantiation(DeclarationBindingType.GlobalCode, program.HoistingScope.FunctionDeclarations, program.HoistingScope.VariableDeclarations, null, null);
 

+ 3 - 3
Jint/Native/Function/EvalFunctionInstance.cs

@@ -33,9 +33,9 @@ namespace Jint.Native.Function
 
             try
             {
-                var parser = new JavaScriptParser(code, new ParserOptions { AdaptRegexp = true, Tolerant = false, Strict = StrictModeScope.IsStrictModeCode });
-                var program = parser.ParseProgram();
-                using (new StrictModeScope(program.IsStrict()))
+                var parser = new JavaScriptParser(code, new ParserOptions { AdaptRegexp = true, Tolerant = false });
+                var program = parser.ParseProgram(true);
+                using (new StrictModeScope(program.Strict))
                 {
                     using (new EvalCodeScope())
                     {

+ 2 - 2
Jint/Native/Function/FunctionConstructor.cs

@@ -98,7 +98,7 @@ namespace Jint.Native.Function
                 Engine,
                 function,
                 LexicalEnvironment.NewDeclarativeEnvironment(Engine, Engine.ExecutionContext.LexicalEnvironment),
-                function.IsStrict()
+                function.Strict
                 ) { Extensible = true };
 
             return functionObject;
@@ -116,7 +116,7 @@ namespace Jint.Native.Function
                 Engine,
                 functionDeclaration,
                 LexicalEnvironment.NewDeclarativeEnvironment(Engine, Engine.ExecutionContext.LexicalEnvironment),
-                functionDeclaration.IsStrict()
+                functionDeclaration.Strict
                 ) { Extensible = true };
 
             return functionObject;

+ 3 - 3
Jint/Runtime/ExpressionIntepreter.cs

@@ -676,7 +676,7 @@ namespace Jint.Runtime
                         }
 
                         ScriptFunctionInstance get;
-                        using (new StrictModeScope(getter.IsStrict()))
+                        using (new StrictModeScope(getter.Strict))
                         {
                             get = new ScriptFunctionInstance(
                                 _engine,
@@ -698,7 +698,7 @@ namespace Jint.Runtime
                         }
 
                         ScriptFunctionInstance set;
-                        using (new StrictModeScope(setter.IsStrict()))
+                        using (new StrictModeScope(setter.Strict))
                         {
 
                             set = new ScriptFunctionInstance(
@@ -792,7 +792,7 @@ namespace Jint.Runtime
                 _engine,
                 functionExpression,
                 funcEnv,
-                functionExpression.IsStrict()
+                functionExpression.Strict
                 );
 
             if (functionExpression.Id != null && !String.IsNullOrEmpty(functionExpression.Id.Name))