From 46ff6bf18f2a598f80aec94b52827ed3ae51815c Mon Sep 17 00:00:00 2001 From: Unknown6656 Date: Sun, 31 Mar 2024 00:51:24 +0100 Subject: [PATCH] began addressing #167 --- .../Extensibility/Plugins.Au3Framework.Functions.cs | 2 +- new/AutoItInterpreter/Runtime/Function.cs | 10 +++++----- new/AutoItInterpreter/Runtime/Macro.cs | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/new/AutoItInterpreter/Extensibility/Plugins.Au3Framework.Functions.cs b/new/AutoItInterpreter/Extensibility/Plugins.Au3Framework.Functions.cs index d46f293..2e4f5a6 100644 --- a/new/AutoItInterpreter/Extensibility/Plugins.Au3Framework.Functions.cs +++ b/new/AutoItInterpreter/Extensibility/Plugins.Au3Framework.Functions.cs @@ -432,7 +432,7 @@ Variant rotate(int size) return rotated; } - return args[2].ToString().ToUpperInvariant() switch + return args[2].ToString().ToUpper() switch { "B" => rotate(8), "W" => rotate(16), diff --git a/new/AutoItInterpreter/Runtime/Function.cs b/new/AutoItInterpreter/Runtime/Function.cs index 2329e65..62f0031 100644 --- a/new/AutoItInterpreter/Runtime/Function.cs +++ b/new/AutoItInterpreter/Runtime/Function.cs @@ -71,7 +71,7 @@ internal ScriptFunction(ScannedScript script, string name) Script.AddFunction(this); } - public override int GetHashCode() => HashCode.Combine(Name.ToUpperInvariant(), Script); + public override int GetHashCode() => HashCode.Combine(Name.ToUpper(), Script); public override bool Equals(object? obj) => Equals(obj as ScriptFunction); @@ -92,7 +92,7 @@ public sealed class AU3Function : ScriptFunction { private readonly ConcurrentDictionary> _lines = new(); - private readonly ConcurrentDictionary _jumplabels = new(); + private readonly ConcurrentDictionary _jumplabels = new(StringComparer.OrdinalIgnoreCase); /// @@ -158,7 +158,7 @@ internal AU3Function(ScannedScript script, string name, IEnumerable !p.IsOptional), Parameters.Length); - JumpLabels = new ReadOnlyIndexer(name => _jumplabels.TryGetValue(name.ToUpperInvariant(), out JumpLabel? label) ? label : null); + JumpLabels = new ReadOnlyIndexer(name => _jumplabels.TryGetValue(name, out JumpLabel? label) ? label : null); } /// @@ -169,9 +169,9 @@ internal AU3Function(ScannedScript script, string name, IEnumerableThe newly created jump label. public JumpLabel AddJumpLabel(SourceLocation location, string name) { - name = name.Trim().ToUpperInvariant(); + name = name.Trim(); - JumpLabel label = new(this, location, name); + JumpLabel label = new(this, location, name.ToUpper()); _jumplabels.AddOrUpdate(name, label, (_, _) => label); diff --git a/new/AutoItInterpreter/Runtime/Macro.cs b/new/AutoItInterpreter/Runtime/Macro.cs index 8156b69..a3b5bcb 100644 --- a/new/AutoItInterpreter/Runtime/Macro.cs +++ b/new/AutoItInterpreter/Runtime/Macro.cs @@ -7,6 +7,7 @@ namespace Unknown6656.AutoIt3.Runtime; + /// /// Represents an AutoIt3 macro. /// Macros are identified using their case-insensitive name and a '@'-prefix. @@ -30,7 +31,7 @@ public class Macro internal Macro(Interpreter interpreter, string name) { Interpreter = interpreter; - Name = name.TrimStart('@').ToUpperInvariant(); + Name = name.TrimStart('@').ToUpper(); } public virtual Variant GetValue(CallFrame frame)