Skip to content

Commit

Permalink
Return old recursion limit capabilities (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma authored Nov 30, 2023
1 parent 3704fb5 commit 422b76e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit 422b76e

Please sign in to comment.