Browse Source

Upgrade to Acornima v1.1.0 (#1898)

adams85 1 year ago
parent
commit
f4f68fc6d9

+ 2 - 2
Directory.Packages.props

@@ -4,8 +4,8 @@
     <CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
   </PropertyGroup>
   <ItemGroup>
-    <PackageVersion Include="Acornima" Version="1.0.0" />
-    <PackageVersion Include="Acornima.Extras" Version="1.0.0" />
+    <PackageVersion Include="Acornima" Version="1.1.0" />
+    <PackageVersion Include="Acornima.Extras" Version="1.1.0" />
     <PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
     <PackageVersion Include="BenchmarkDotNet.TestAdapter" Version="0.13.12" />
     <PackageVersion Include="FluentAssertions" Version="6.12.0" />

+ 3 - 3
Jint.Tests.PublicInterface/RavenApiUsageTests.cs

@@ -16,7 +16,7 @@ public class RavenApiUsageTests
     {
         var engine = new Engine();
 
-        var properties = new List<Node>
+        var properties = new Node[]
         {
             new ObjectProperty(PropertyKind.Init, new Identifier("field"),
                 new MemberExpression(new Identifier("self"), new Identifier("field"), computed: false, optional: false), false, false, false)
@@ -24,8 +24,8 @@ public class RavenApiUsageTests
 
         var functionExp = new FunctionExpression(
             new Identifier("functionId"),
-            NodeList.Create<Node>(new List<Expression> { new Identifier("self") }),
-            new FunctionBody(NodeList.Create(new List<Statement> { new ReturnStatement(new ObjectExpression(NodeList.Create(properties))) }), strict: false),
+            NodeList.From<Node>(new Identifier("self")),
+            new FunctionBody(NodeList.From<Statement>(new ReturnStatement(new ObjectExpression(NodeList.From(properties)))), strict: false),
             generator: false,
             async: false);
 

+ 1 - 1
Jint/Engine.Ast.cs

@@ -54,7 +54,7 @@ public partial class Engine
             _preparationOptions = preparationOptions;
         }
 
-        public void NodeVisitor(Node node)
+        public void NodeVisitor(Node node, OnNodeContext _)
         {
             switch (node.Type)
             {

+ 1 - 1
Jint/Native/Function/ClassDefinition.cs

@@ -282,7 +282,7 @@ internal sealed class ClassDefinition
 
         public ClassFieldFunction(Expression expression) : base(NodeType.ExpressionStatement)
         {
-            var nodeList = NodeList.Create<Statement>(new [] { new ReturnStatement(expression) });
+            var nodeList = NodeList.From<Statement>(new ReturnStatement(expression));
             _statement = new FunctionBody(nodeList, strict: true);
         }
 

+ 1 - 1
Jint/Runtime/Interpreter/Expressions/JintArrayExpression.cs

@@ -118,7 +118,7 @@ namespace Jint.Runtime.Interpreter.Expressions
 
         internal sealed class JintEmptyArrayExpression : JintExpression
         {
-            public static JintEmptyArrayExpression Instance = new(new ArrayExpression(NodeList.Create(System.Linq.Enumerable.Empty<Expression?>())));
+            public static JintEmptyArrayExpression Instance = new(new ArrayExpression(NodeList.From(Array.Empty<Expression?>())));
 
             private JintEmptyArrayExpression(Expression expression) : base(expression)
             {

+ 1 - 1
Jint/Runtime/Interpreter/Expressions/JintObjectExpression.cs

@@ -246,7 +246,7 @@ namespace Jint.Runtime.Interpreter.Expressions
 
         internal sealed class JintEmptyObjectExpression : JintExpression
         {
-            public static JintEmptyObjectExpression Instance = new(new ObjectExpression(NodeList.Create(System.Linq.Enumerable.Empty<Node>())));
+            public static JintEmptyObjectExpression Instance = new(new ObjectExpression(NodeList.From(Array.Empty<Node>())));
 
             private JintEmptyObjectExpression(Expression expression) : base(expression)
             {

+ 1 - 1
Jint/Runtime/Modules/ModuleBuilder.cs

@@ -136,7 +136,7 @@ public sealed class ModuleBuilder
 
         if (_sourceRaw.Count <= 0)
         {
-            return new Prepared<AstModule>(new AstModule(NodeList.Create(Array.Empty<Statement>())), parserOptions);
+            return new Prepared<AstModule>(new AstModule(NodeList.From(Array.Empty<Statement>())), parserOptions);
         }
 
         var parser = new Parser(parserOptions);