Browse Source

Upgrade Esprima to 2.0.0-beta-1338 (#830)

* adapt code after Loc and Range were removed
Marko Lahma 4 years ago
parent
commit
238c308e59

+ 0 - 2
Jint.Repl/Program.cs

@@ -48,8 +48,6 @@ namespace Jint.Repl
             var defaultColor = Console.ForegroundColor;
             var parserOptions = new ParserOptions("repl")
             {
-                Loc = true,
-                Range = true,
                 Tolerant = true,
                 AdaptRegexp = true
             };

+ 1 - 2
Jint.Tests.Test262/Test262Test.cs

@@ -370,8 +370,7 @@ namespace Jint.Tests.Test262
             new ParserOptions(fileName)
             {
                 AdaptRegexp = true,
-                Tolerant = true,
-                Loc = true
+                Tolerant = true
             };
     }
     

+ 1 - 1
Jint.Tests/Parser/JavascriptParserTests.cs

@@ -159,7 +159,7 @@ namespace Jint.Tests.Parser
 \
 '
 ";
-            var program = new JavaScriptParser(source, new ParserOptions { Loc = true }).ParseScript();
+            var program = new JavaScriptParser(source, new ParserOptions()).ParseScript();
             var expr = program.Body.First().As<ExpressionStatement>().Expression;
             Assert.Equal(1, expr.Location.Start.Line);
             Assert.Equal(0, expr.Location.Start.Column);

+ 3 - 3
Jint.Tests/Runtime/Debugger/BreakPointTests.cs

@@ -64,15 +64,15 @@ test(z);";
 
             // We need to specify the source to the parser.
             // And we need locations too (Jint specifies that in its default options)
-            engine.Execute(script1, new ParserOptions("script1") { Loc = true });
+            engine.Execute(script1, new ParserOptions("script1"));
             Assert.False(didBreak);
 
-            engine.Execute(script2, new ParserOptions("script2") { Loc = true });
+            engine.Execute(script2, new ParserOptions("script2"));
             Assert.False(didBreak); 
 
             // Note that it's actually script3 that executes the function in script2
             // and triggers the breakpoint
-            engine.Execute(script3, new ParserOptions("script3") { Loc = true });
+            engine.Execute(script3, new ParserOptions("script3"));
             Assert.True(didBreak);
         }
 

+ 2 - 2
Jint.Tests/Runtime/ErrorTests.cs

@@ -64,9 +64,9 @@ var c = a(b().Length);
 
 var b = function(v) {
 	return a(v);
-}", new ParserOptions("custom.js") { Loc = true });
+}", new ParserOptions("custom.js"));
 
-            var e = Assert.Throws<JavaScriptException>(() => engine.Execute("var x = b(7);", new ParserOptions("main.js") { Loc = true } ));
+            var e = Assert.Throws<JavaScriptException>(() => engine.Execute("var x = b(7);", new ParserOptions("main.js")));
             Assert.Equal("Cannot read property 'yyy' of undefined", e.Message);
             Assert.Equal(2, e.Location.Start.Line);
             Assert.Equal(17, e.Location.Start.Column);

+ 2 - 3
Jint/Engine.cs

@@ -39,11 +39,10 @@ namespace Jint
 {
     public class Engine
     {
-        internal static readonly ParserOptions DefaultParserOptions = new("<anonymous>")
+        private static readonly ParserOptions DefaultParserOptions = new("<anonymous>")
         {
             AdaptRegexp = true,
-            Tolerant = true,
-            Loc = true
+            Tolerant = true
         };
 
         private static readonly JsString _errorFunctionName = new JsString("Error");

+ 1 - 1
Jint/Jint.csproj

@@ -7,7 +7,7 @@
     <LangVersion>latest</LangVersion>
   </PropertyGroup>
   <ItemGroup>
-    <PackageReference Include="Esprima" Version="2.0.0-beta-1331" />
+    <PackageReference Include="Esprima" Version="2.0.0-beta-1338" />
     <PackageReference Include="Nullable" Version="1.3.0" PrivateAssets="all" />
   </ItemGroup>
 </Project>