@@ -228,7 +228,7 @@ public static bool TryFindFunctionDefinition(this Ast ast, CommandAst command, o
228
228
{
229
229
if ( ast is not FunctionDefinitionAst funcDef ) { return false ; }
230
230
231
- if ( funcDef . Name . ToLower ( ) != name ) { return false ; }
231
+ if ( ! funcDef . Name . Equals ( name , StringComparison . CurrentCultureIgnoreCase ) ) { return false ; }
232
232
233
233
// If the function is recursive (calls itself), its parent is a match unless a more specific in-scope function definition comes next (this is a "bad practice" edge case)
234
234
// TODO: Consider a simple "contains" match
@@ -298,10 +298,10 @@ public static IEnumerable<Ast> FindParents(this Ast ast, params Type[] types)
298
298
(
299
299
ast => ast is FunctionDefinitionAst funcDef
300
300
&& funcDef . StartsBefore ( target )
301
- && funcDef . Name . ToLower ( ) == functionName . ToLower ( )
301
+ && funcDef . Name . Equals ( functionName , StringComparison . CurrentCultureIgnoreCase )
302
302
&& ( funcDef . Parameters ?? funcDef . Body . ParamBlock . Parameters )
303
303
. SingleOrDefault (
304
- param => param . Name . GetUnqualifiedName ( ) . ToLower ( ) == parameterName . ToLower ( )
304
+ param => param . Name . GetUnqualifiedName ( ) . Equals ( parameterName , StringComparison . CurrentCultureIgnoreCase )
305
305
) is not null
306
306
, false
307
307
) . LastOrDefault ( ) as FunctionDefinitionAst ;
@@ -311,7 +311,7 @@ public static IEnumerable<Ast> FindParents(this Ast ast, params Type[] types)
311
311
return ( funcDef . Parameters ?? funcDef . Body . ParamBlock . Parameters )
312
312
. SingleOrDefault
313
313
(
314
- param => param . Name . GetUnqualifiedName ( ) . ToLower ( ) == parameterName . ToLower ( )
314
+ param => param . Name . GetUnqualifiedName ( ) . Equals ( parameterName , StringComparison . CurrentCultureIgnoreCase )
315
315
) ? . Name ; //Should not be null at this point
316
316
}
317
317
@@ -384,7 +384,7 @@ public static bool IsScopedVariableAssignment(this VariableExpressionAst var)
384
384
return assignmentAst . FindStartsAfter ( ast =>
385
385
ast is VariableExpressionAst var
386
386
&& var . Splatted
387
- && var . GetUnqualifiedName ( ) . ToLower ( ) == leftAssignVarAst . GetUnqualifiedName ( ) . ToLower ( )
387
+ && var . GetUnqualifiedName ( ) . Equals ( leftAssignVarAst . GetUnqualifiedName ( ) , StringComparison . CurrentCultureIgnoreCase )
388
388
, true ) as VariableExpressionAst ;
389
389
}
390
390
@@ -464,7 +464,7 @@ public static bool TryGetFunction(this ParameterAst ast, out FunctionDefinitionA
464
464
_ => null
465
465
} ;
466
466
ParameterAst ? matchParam = parameters ? . SingleOrDefault (
467
- param => param . Name . GetUnqualifiedName ( ) . ToLower ( ) == name . ToLower ( )
467
+ param => param . Name . GetUnqualifiedName ( ) . Equals ( name , StringComparison . CurrentCultureIgnoreCase )
468
468
) ;
469
469
if ( matchParam is not null )
470
470
{
@@ -491,7 +491,7 @@ public static bool TryGetFunction(this ParameterAst ast, out FunctionDefinitionA
491
491
varAssignment = reference switch
492
492
{
493
493
VariableExpressionAst => scope . FindStartsBefore < VariableExpressionAst > ( var =>
494
- var . GetUnqualifiedName ( ) . ToLower ( ) == name . ToLower ( )
494
+ var . GetUnqualifiedName ( ) . Equals ( name , StringComparison . CurrentCultureIgnoreCase )
495
495
&& (
496
496
( var . IsVariableAssignment ( ) && ! var . IsOperatorAssignment ( ) )
497
497
|| var . IsScopedVariableAssignment ( )
@@ -500,7 +500,7 @@ public static bool TryGetFunction(this ParameterAst ast, out FunctionDefinitionA
500
500
) ,
501
501
502
502
CommandParameterAst param => scope . FindStartsBefore < VariableExpressionAst > ( var =>
503
- var . GetUnqualifiedName ( ) . ToLower ( ) == name . ToLower ( )
503
+ var . GetUnqualifiedName ( ) . Equals ( name , StringComparison . CurrentCultureIgnoreCase )
504
504
&& var . Parent is ParameterAst paramAst
505
505
&& paramAst . TryGetFunction ( out FunctionDefinitionAst ? foundFunction )
506
506
&& foundFunction ? . Name . ToLower ( )
0 commit comments