Skip to content

Commit

Permalink
began addressing #167
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown6656 committed Mar 30, 2024
1 parent ef9ae6e commit 46ff6bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
10 changes: 5 additions & 5 deletions new/AutoItInterpreter/Runtime/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -92,7 +92,7 @@ public sealed class AU3Function
: ScriptFunction
{
private readonly ConcurrentDictionary<SourceLocation, List<string>> _lines = new();
private readonly ConcurrentDictionary<string, JumpLabel> _jumplabels = new();
private readonly ConcurrentDictionary<string, JumpLabel> _jumplabels = new(StringComparer.OrdinalIgnoreCase);


/// <summary>
Expand Down Expand Up @@ -158,7 +158,7 @@ internal AU3Function(ScannedScript script, string name, IEnumerable<PARAMETER_DE
{
Parameters = @params?.ToArray() ?? [];
ParameterCount = (Parameters.Count(p => !p.IsOptional), Parameters.Length);
JumpLabels = new ReadOnlyIndexer<string, JumpLabel?>(name => _jumplabels.TryGetValue(name.ToUpperInvariant(), out JumpLabel? label) ? label : null);
JumpLabels = new ReadOnlyIndexer<string, JumpLabel?>(name => _jumplabels.TryGetValue(name, out JumpLabel? label) ? label : null);
}

/// <summary>
Expand All @@ -169,9 +169,9 @@ internal AU3Function(ScannedScript script, string name, IEnumerable<PARAMETER_DE
/// <returns>The newly created jump label.</returns>
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);

Expand Down
3 changes: 2 additions & 1 deletion new/AutoItInterpreter/Runtime/Macro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Unknown6656.AutoIt3.Runtime;


/// <summary>
/// Represents an AutoIt3 macro.
/// Macros are identified using their case-insensitive name and a '@'-prefix.
Expand All @@ -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)
Expand Down

0 comments on commit 46ff6bf

Please sign in to comment.