Skip to content

Commit

Permalink
switched to collection expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown6656 committed Nov 9, 2023
1 parent bbd2c6f commit 07ae0ab
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion new/AutoItInterpreter/CommandLineInterface/MainProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ prefix.Length switch
$"{node.PercentageOfTotal * 100,9:F5} %",
}, node));

TelemetryTimingsNode[] children = node.Children.OrderByDescending(c => c.PercentageOfTotal).ToArray();
TelemetryTimingsNode[] children = [.. node.Children.OrderByDescending(c => c.PercentageOfTotal)];

for (int i = 0; i < children.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Linq;
using System;
Expand Down Expand Up @@ -146,7 +146,7 @@ void add_token(int length, TokenType type)
add_token(0, TokenType.NewLine);
}

return tokens.ToArray();
return [.. tokens];
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion new/AutoItInterpreter/Extensibility/Plugins.Debugging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public FunctionReturnValue DebugCodeLines(CallFrame frame, Variant[] _)

public FunctionReturnValue DebugAllThreads(CallFrame frame, Variant[] _)
{
AU3Thread[] threads = frame.Interpreter.Threads.Where(t => !t.IsDisposed).OrderBy(t => t.ThreadID).ToArray();
AU3Thread[] threads = [.. frame.Interpreter.Threads.Where(t => !t.IsDisposed).OrderBy(t => t.ThreadID)];
StringBuilder sb = new();

sb.AppendLine($"Overview ({threads.Length} threads):");
Expand Down
2 changes: 1 addition & 1 deletion new/AutoItInterpreter/Runtime/CallFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ internal AU3CallFrame(AU3Thread thread, CallFrame? caller, AU3Function function,
LastStatementValue = (caller as AU3CallFrame)?.LastStatementValue ?? Variant.Null;
CurrentFunction = function;
InterpreterRunContext = context;
_line_cache = function.Lines.ToList();
_line_cache = [.. function.Lines];
_instruction_pointer = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion new/AutoItInterpreter/Runtime/DelegateBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ ParameterBuilder ProcessParameter(int index, TYPE type)
; // TODO
else if (type is TYPE.Composite { Item: { } types })
{
TYPE[] otypes = types.ToArray();
TYPE[] otypes = [.. types];
Type?[] fields = types.ToArray(t => ConvertType(t, true));
bool unicode = otypes.Any(t => t.IsWSTR);

Expand Down
4 changes: 2 additions & 2 deletions new/AutoItInterpreter/Runtime/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public override SourceLocation Location
{
get
{
SourceLocation[] lines = _lines.Keys.OrderBy(LINQ.id).ToArray();
SourceLocation[] lines = [.. _lines.Keys.OrderBy(LINQ.id)];

if (lines.Length > 0)
return new SourceLocation(lines[0].FullFileName, lines[0].StartLineNumber, lines[^1].EndLineNumber);
Expand Down Expand Up @@ -248,7 +248,7 @@ public FunctionReturnValue Execute(NativeCallFrame frame, Variant[] args)
else if (a.Count > ParameterCount.MaximumCount)
a.RemoveRange(ParameterCount.MaximumCount, a.Count - ParameterCount.MaximumCount);

return _execute(frame, a.ToArray());
return _execute(frame, [.. a]);
}

public override string ToString() => "[native] Func " + Name;
Expand Down
2 changes: 1 addition & 1 deletion new/util/AutoIt3.COM.Server/COMServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ internal COMWrapper(COMServer server, object com, Type type)
}
while (type is { } && type != typeof(object));

_cached_members = members.ToArray();
_cached_members = [.. members];

Server.DebugPrint("debug.com.wrapper.created", (long)IUnknownPtr, ObjectType);
}
Expand Down

0 comments on commit 07ae0ab

Please sign in to comment.