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

Return old recursion limit capabilities #426

Merged
merged 1 commit into from
Nov 30, 2023
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
4 changes: 3 additions & 1 deletion src/Esprima/JavaScriptParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ private T IsolateCoverGrammar<T>(Func<T> parseFunction) where T : Node
return result;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
[MethodImpl(MethodImplOptions.AggressiveInlining | (MethodImplOptions) 512)]
private T InheritCoverGrammar<T>(Func<T> parseFunction) where T : Node
{
var previousIsBindingElement = _context.IsBindingElement;
Expand Down Expand Up @@ -677,6 +677,7 @@ private void ConsumeSemicolon()

// https://tc39.github.io/ecma262/#sec-primary-expression

[MethodImpl((MethodImplOptions) 512)]
private protected virtual Expression ParsePrimaryExpression()
{
var node = CreateNode();
Expand Down Expand Up @@ -2318,6 +2319,7 @@ private int BinaryPrecedence(in Token token)
private Stack<int>? _precedencesStack;
private ArrayList<object>? _sharedStack;

[MethodImpl((MethodImplOptions) 512)]
private Expression ParseBinaryExpression()
{
var startToken = _lookahead;
Expand Down
2 changes: 1 addition & 1 deletion test/Esprima.Tests/JavaScriptParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void CanHandleDeepNestingWithoutStackOverflow()
#if DEBUG
const int Depth = 205;
#else
const int Depth = 385;
const int Depth = 520;
#endif
var input = $"if ({new string('(', Depth)}true{new string(')', Depth)}) {{ }}";
parser.ParseScript(input);
Expand Down