Skip to content

Commit

Permalink
Add more Acornima friendly type aliases (#1825)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma authored Mar 31, 2024
1 parent aca8fb3 commit 5656b1d
Show file tree
Hide file tree
Showing 29 changed files with 233 additions and 232 deletions.
7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@
<Using Include="Esprima" />
<Using Include="Esprima.Ast" />
<Using Include="Esprima.Utils" />
<Using Include="Esprima.Location" Alias="SourceLocation" />

<Using Include="Esprima.Ast.BindingPattern" Alias="DestructuringPattern" />
<Using Include="Esprima.Ast.Nodes" Alias="NodeType" />
<Using Include="Esprima.JavaScriptParser" Alias="Parser" />
<Using Include="Esprima.Location" Alias="SourceLocation" />
<Using Include="Esprima.TokenType" Alias="TokenKind" />
<Using Include="Esprima.ParserException" Alias="ParseErrorException" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Jint.Benchmark/EngineComparisonBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class EngineComparisonBenchmark
[GlobalSetup]
public void Setup()
{
var javaScriptParser = new JavaScriptParser();
var parser = new Parser();
foreach (var fileName in _files.Keys.ToList())
{
var script = File.ReadAllText($"Scripts/{fileName}.js");
Expand All @@ -47,7 +47,7 @@ public void Setup()
script = _dromaeoHelpers + Environment.NewLine + Environment.NewLine + script;
}
_files[fileName] = script;
_parsedScripts[fileName] = javaScriptParser.ParseScript(script, strict: true);
_parsedScripts[fileName] = parser.ParseScript(script, strict: true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Jint.Benchmark/EngineConstructionBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class EngineConstructionBenchmark
[GlobalSetup]
public void GlobalSetup()
{
var parser = new JavaScriptParser();
var parser = new Parser();
_program = parser.ParseScript("([].length + ''.length)");
_simple = parser.ParseScript("1");
new Engine().Evaluate(_program);
Expand Down
1 change: 1 addition & 0 deletions Jint.Benchmark/Jint.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
<ItemGroup>
<Using Include="Esprima" />
<Using Include="Esprima.Ast" />
<Using Include="Esprima.JavaScriptParser" Alias="Parser" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Jint.Tests.CommonScripts/ConcurrencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public void ConcurrentEnginesCanUseSameAst(bool prepared)
var scriptContents = SunSpiderTests.GetEmbeddedFile("babel-standalone.js");
var script = prepared
? Engine.PrepareScript(scriptContents)
: new JavaScriptParser().ParseScript(scriptContents);
: new Parser().ParseScript(scriptContents);

Parallel.ForEach(Enumerable.Range(0, 3), x =>
{
Expand Down
2 changes: 1 addition & 1 deletion Jint.Tests.PublicInterface/ShadowRealmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void CanReuseScriptWithShadowRealm()
var shadowRealm2 = engine.Intrinsics.ShadowRealm.Construct();
shadowRealm2.SetValue("message", "realm 2");

var parser = new Esprima.JavaScriptParser();
var parser = new Parser();
var script = parser.ParseScript("(function hello() {return \"hello \" + message})();");

// Act & Assert
Expand Down
4 changes: 2 additions & 2 deletions Jint.Tests.Test262/Test262Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private Engine BuildTestExecutor(Test262File file)
}
var options = new ParserOptions { RegExpParseMode = RegExpParseMode.AdaptToInterpreted, Tolerant = false };
var parser = new JavaScriptParser(options);
var parser = new Parser(options);
var script = parser.ParseScript(args.At(0).AsString());
return engine.Evaluate(script);
Expand Down Expand Up @@ -93,7 +93,7 @@ private static void ExecuteTest(Engine engine, Test262File file)
}
else
{
engine.Execute(new JavaScriptParser().ParseScript(file.Program, source: file.FileName));
engine.Execute(new Parser().ParseScript(file.Program, source: file.FileName));
}
}

Expand Down
Loading

0 comments on commit 5656b1d

Please sign in to comment.