Skip to content

Commit a13eff2

Browse files
Declare scope prefixes array as static readonly (#1991)
1 parent 422e2cd commit a13eff2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/PowerShellEditorServices/Utility/VisitorUtils.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,18 @@ internal static class VisitorUtils
3333
return PSESSymbols.AstOperations.TryGetInferredValue(expandableStringExpressionAst, out string value) ? value : null;
3434
}
3535

36+
private static readonly string[] s_scopes = new string[]
37+
{
38+
"private:",
39+
"script:",
40+
"global:",
41+
"local:"
42+
};
43+
3644
// Strip the qualification, if there is any, so script:my-function is a reference of my-function etc.
3745
internal static string GetUnqualifiedFunctionName(string name)
3846
{
39-
foreach (string scope in new string[] { "private:", "script:", "global:", "local:" })
47+
foreach (string scope in s_scopes)
4048
{
4149
if (name.StartsWith(scope, StringComparison.OrdinalIgnoreCase))
4250
{

0 commit comments

Comments
 (0)