Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more Acornima friendly type aliases #1825

Merged
merged 2 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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