Skip to content

Commit 484ddac

Browse files
Extract local function
1 parent 043940e commit 484ddac

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Compilers/CSharp/Portable/Parser/LanguageParser.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6288,11 +6288,7 @@ private StatementSyntax ParseStatementCore(bool isGlobalScriptLevel)
62886288
_recursionDepth++;
62896289
StackGuard.EnsureSufficientExecutionStack(_recursionDepth);
62906290

6291-
// Can only reuse a global-script or regular statement if we're in the same
6292-
// global-script context we were originally in.
6293-
if (this.IsIncrementalAndFactoryContextMatches &&
6294-
this.CurrentNode is CSharp.Syntax.StatementSyntax &&
6295-
isGlobalScriptLevel == (this.CurrentNode.Parent is Syntax.GlobalStatementSyntax))
6291+
if (canReuseStatement(isGlobalScriptLevel))
62966292
{
62976293
return (StatementSyntax)this.EatNode();
62986294
}
@@ -6363,6 +6359,15 @@ this.CurrentNode is CSharp.Syntax.StatementSyntax &&
63636359
_recursionDepth--;
63646360
this.Release(ref resetPointBeforeStatement);
63656361
}
6362+
6363+
bool canReuseStatement(bool isGlobalScriptLevel)
6364+
{
6365+
// Can only reuse a global-script or regular statement if we're in the same
6366+
// global-script context we were originally in.
6367+
return this.IsIncrementalAndFactoryContextMatches &&
6368+
this.CurrentNode is CSharp.Syntax.StatementSyntax &&
6369+
isGlobalScriptLevel == (this.CurrentNode.Parent is Syntax.GlobalStatementSyntax);
6370+
}
63666371
}
63676372

63686373
private StatementSyntax ParseStatementCoreRest(bool isGlobalScriptLevel, ref ResetPoint resetPointBeforeStatement)

0 commit comments

Comments
 (0)