diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 42516d92e..3d5a20c97 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "csharpier": { - "version": "1.3.0", + "version": "1.4.1", "commands": [ "csharpier" ], @@ -31,4 +31,4 @@ "rollForward": false } } -} \ No newline at end of file +} diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 0b729a60e..a279aa550 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -12,7 +12,7 @@ ARG TARGETARCH=amd64 # Pinned checksum for Microsoft package repository bootstrap package. ARG MS_PACKAGES_DEB_SHA256=8434dcb8c346dc95fbd63dbece056c343704590b58b6a5c323d39acf52bf0b48 # Keep this in sync with global.json. scripts/lint/check-tooling-consistency.py enforces it. -ARG DOTNET_SDK_MAJOR_MINOR=9.0 +ARG DOTNET_SDK_MAJOR_MINOR=10.0 # Pinned Lua source version and checksum. ARG LUA55_VERSION=5.5.0 ARG LUA55_SHA256=57ccc32bbbd005cab75bcc52444052535af691789dba2b9016d5c50640d68b3d diff --git a/.github/workflows/nuget-publish.yml b/.github/workflows/nuget-publish.yml index c4c55424c..e1267d4bb 100644 --- a/.github/workflows/nuget-publish.yml +++ b/.github/workflows/nuget-publish.yml @@ -69,12 +69,13 @@ jobs: run: dotnet build src/NovaSharp.sln -c Release -p:Version=${{ steps.version.outputs.version }} - name: Run tests + env: + DOTNET_ROLL_FORWARD: Major run: | - dotnet test \ + dotnet test --project \ src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj \ -c Release \ --no-build \ - -- \ --report-trx --report-trx-filename "test-results.trx" - name: Pack NuGet packages diff --git a/.llm/skills/ci-workflow/references/REFERENCE.md b/.llm/skills/ci-workflow/references/REFERENCE.md index a62822fa8..586368a2a 100644 --- a/.llm/skills/ci-workflow/references/REFERENCE.md +++ b/.llm/skills/ci-workflow/references/REFERENCE.md @@ -39,16 +39,13 @@ NovaSharp uses TUnit on Microsoft.Testing.Platform. ``` -### Platform Options Separator +### Microsoft.Testing.Platform options -Options for the test platform MUST come after `--`: +Run a specific project with `--project` and pass runner options directly to +`dotnet test`. When using `dotnet run`, place runner options after `--`. ```bash -# WRONG -dotnet test --results-directory ./results --report-trx - -# CORRECT -dotnet test -- --results-directory ./results --report-trx +dotnet test --project path/to/TestProject.csproj --results-directory ./results --report-trx ``` ______________________________________________________________________ diff --git a/docs/Contributing.md b/docs/Contributing.md index a0d241137..324bd2944 100644 --- a/docs/Contributing.md +++ b/docs/Contributing.md @@ -4,7 +4,7 @@ This project keeps the build/test tooling and documentation in lockstep. Use thi ## Environment & Tooling -- Install the .NET SDK pinned by `global.json` (currently 9.0.100 with latest-minor roll-forward). +- Install the .NET SDK pinned by `global.json` (currently 10.0.100 with latest-minor roll-forward). - Install Python 3.10+ (CI uses 3.12) and restore the shared tooling dependencies once per clone: ```bash python -m pip install -r requirements.tooling.txt @@ -22,8 +22,7 @@ This project keeps the build/test tooling and documentation in lockstep. Use thi - Full solution build: `dotnet build src/NovaSharp.sln -c Release` - Interpreter-only build: `dotnet build src/runtime/WallstopStudios.NovaSharp.Interpreter/WallstopStudios.NovaSharp.Interpreter.csproj` -- Interpreter tests (Release):\ - `dotnet test src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj -c Release -- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx` +- Interpreter tests (Release): `./scripts/test/quick.sh` ## Coverage diff --git a/docs/Testing.md b/docs/Testing.md index 9a0c12647..7c35d7171 100644 --- a/docs/Testing.md +++ b/docs/Testing.md @@ -11,7 +11,9 @@ NovaSharp ships with a comprehensive test suite that blends historical Lua fixtu ## Running the Tests Locally ```bash -dotnet test src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj -c Release -- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx +DOTNET_ROLL_FORWARD=Major dotnet test \ + --project src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj \ + -c Release --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx ``` - Produces a standards-based TRX file under `TestResults/` (or the supplied `--results-directory`) so failures can be inspected with the test explorer of your choice. @@ -19,9 +21,9 @@ dotnet test src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Wallstop ### Microsoft.Testing.Platform runner -- `global.json` pins `test.runner` to `Microsoft.Testing.Platform`, so every `dotnet test` invocation must pass an explicit target path, solution, or test module. Use the positional project path shown above; test-platform options still go after the `--` separator. +- The .NET 10 SDK selects Microsoft.Testing.Platform through `global.json`. Use `--project` when selecting a test project from the repository root and pass runner options directly to `dotnet test`. - The interpreter TUnit suite completes quickly on a many-core workstation; expect a slower first run when a clean build is required because the Microsoft.Testing.Platform entry point is re-generated. -- Visual Studio and Rider inherit the same configuration because the runner is set in `global.json`; if a local command fails with “VSTest target is no longer supported”, re-run it with the explicit target path shown above so the Microsoft.Testing.Platform mode is engaged. +- IDEs that honor the SDK test runner configuration use the Microsoft.Testing.Platform setting in `global.json`. ### TUnit-first policy @@ -59,9 +61,7 @@ bash ./scripts/build/build.sh pwsh ./scripts/coverage/coverage.ps1 ``` -- If the host only has .NET 9 installed (common on new Ubuntu images), set `DOTNET_ROLL_FORWARD=Major` when invoking the script (PowerShell or Bash) so the .NET 9 runtime can execute the net8.0 testhost. - -- Restores local tools, builds the solution in Release, and drives `dotnet test` through the `coverlet.console` wrapper so the TUnit suites execute exactly as they do in CI. +- Restores local tools, builds the solution in Release, and runs the TUnit test application through the `coverlet.console` wrapper. - Emits LCOV, Cobertura, and OpenCover artefacts under `artifacts/coverage`, with the TRX test logs in `artifacts/coverage/test-results`. @@ -69,7 +69,7 @@ pwsh ./scripts/coverage/coverage.ps1 - Pass `-SkipBuild` to reuse existing binaries and `-Configuration Debug` to collect non-Release stats. -- On macOS/Linux without PowerShell, run `bash ./scripts/coverage/coverage.sh` (identical flags/behaviour). Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when it isn’t already defined so .NET 9 runtimes can execute the net8.0 testhost; override the variable if you need different roll-forward behaviour. +- On macOS/Linux without PowerShell, run `bash ./scripts/coverage/coverage.sh` (identical flags/behaviour). Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when it isn’t already defined so newer .NET runtimes can execute the .NET 8 test host. Set the variable explicitly to use a different roll-forward policy. - Both coverage helpers honour gating settings: set `COVERAGE_GATING_MODE` to `monitor` (warn) or `enforce` (fail), and override the per-metric targets via `COVERAGE_GATING_TARGET_LINE`, `COVERAGE_GATING_TARGET_BRANCH`, and `COVERAGE_GATING_TARGET_METHOD`. CI now exports `COVERAGE_GATING_MODE=enforce` with **80 % line / 80 % branch / 80 % method** thresholds so coverage dips fail fast; set the mode to `monitor` locally if you need a warning-only rehearsal. To mirror the enforced gate (the default in CI), export the same settings before rerunning the script: @@ -191,7 +191,8 @@ Validation checklist: ```powershell dotnet build src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/WallstopStudios.NovaSharp.VsCodeDebugger.csproj -c Release -nologo dotnet build src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/WallstopStudios.NovaSharp.RemoteDebugger.csproj -c Release -nologo -dotnet test src/tests/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit.csproj -c Release --filter "FullyQualifiedName~RemoteDebugger" +$env:DOTNET_ROLL_FORWARD = 'Major' +dotnet test --project src/tests/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit.csproj -c Release ``` Document new suppressions or analyzer exclusions in the closest authoritative analyzer documentation (with the CA rule, justification, and follow-up owner) before merging. diff --git a/docs/audits/documentation_audit.log b/docs/audits/documentation_audit.log index 00996e751..4e57cc3d2 100644 --- a/docs/audits/documentation_audit.log +++ b/docs/audits/documentation_audit.log @@ -10,20 +10,20 @@ Found 185 undocumented public/internal type declarations. - src/runtime/WallstopStudios.NovaSharp.Interpreter/CompiledScript.cs - line 621: missing XML docs for `ExecuteValues()` - src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/DebugModule.cs - - line 1620: missing XML docs for `Value` - - line 1625: missing XML docs for `Function` - - line 1626: missing XML docs for `Mask` - - line 1627: missing XML docs for `Count` - - line 1640: missing XML docs for `Upvalue` - - line 1642: missing XML docs for `ReferenceId` - - line 1644: missing XML docs for `ToString()` - - line 1655: missing XML docs for `Name` - - line 1657: missing XML docs for `Type` - - line 1659: missing XML docs for `TryIndex()` - - line 1671: missing XML docs for `SetIndex()` - - line 1682: missing XML docs for `AsString()` - - line 1692: missing XML docs for `TryMetaIndex()` - - line 1698: missing XML docs for `IsTypeCompatible()` + - line 1617: missing XML docs for `Value` + - line 1622: missing XML docs for `Function` + - line 1623: missing XML docs for `Mask` + - line 1624: missing XML docs for `Count` + - line 1637: missing XML docs for `Upvalue` + - line 1639: missing XML docs for `ReferenceId` + - line 1641: missing XML docs for `ToString()` + - line 1652: missing XML docs for `Name` + - line 1654: missing XML docs for `Type` + - line 1656: missing XML docs for `TryIndex()` + - line 1668: missing XML docs for `SetIndex()` + - line 1679: missing XML docs for `AsString()` + - line 1689: missing XML docs for `TryMetaIndex()` + - line 1695: missing XML docs for `IsTypeCompatible()` - src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/IO/FileUserDataDescriptor.cs - line 22: missing XML docs for `Name` - line 24: missing XML docs for `Type` @@ -157,9 +157,9 @@ Found 185 undocumented public/internal type declarations. - src/runtime/WallstopStudios.NovaSharp.Interpreter/Script.cs - line 626: missing XML docs for `BeginDefaultOptionsScope()` - line 734: missing XML docs for `RegisterCoroutineForMemoryStatistics()` - - line 4817: missing XML docs for `GetTrackedCoroutineCountForMemoryStatisticsForTests()` - - line 4825: missing XML docs for `GetEstimatedScriptRetainedBytesForMemoryStatisticsForTests()` - - line 4952: missing XML docs for `Dispose()` + - line 4811: missing XML docs for `GetTrackedCoroutineCountForMemoryStatisticsForTests()` + - line 4819: missing XML docs for `GetEstimatedScriptRetainedBytesForMemoryStatisticsForTests()` + - line 4946: missing XML docs for `Dispose()` - src/runtime/WallstopStudios.NovaSharp.Interpreter/Utilities/OneOf/FastOneOf2.cs - line 198: missing XML docs for `FromT0()` - line 211: missing XML docs for `FromT1()` @@ -210,15 +210,15 @@ Found 185 undocumented public/internal type declarations. - line 110: missing XML docs for `DeleteFile()` - line 112: missing XML docs for `MoveFile()` - line 114: missing XML docs for `ExecuteCommand()` - - line 212: missing XML docs for `ExitFast()` - - line 252: missing XML docs for `class Program` - - line 393: missing XML docs for `Main()` - - line 1058: missing XML docs for `CanRead` - - line 1060: missing XML docs for `CanSeek` - - line 1062: missing XML docs for `CanWrite` - - line 1064: missing XML docs for `Length` - - line 1072: missing XML docs for `Flush()` - - line 1074: missing XML docs for `Write()` - - line 1079: missing XML docs for `Read()` - - line 1084: missing XML docs for `Seek()` - - line 1089: missing XML docs for `SetLength()` + - line 211: missing XML docs for `ExitFast()` + - line 251: missing XML docs for `class Program` + - line 392: missing XML docs for `Main()` + - line 1057: missing XML docs for `CanRead` + - line 1059: missing XML docs for `CanSeek` + - line 1061: missing XML docs for `CanWrite` + - line 1063: missing XML docs for `Length` + - line 1071: missing XML docs for `Flush()` + - line 1073: missing XML docs for `Write()` + - line 1078: missing XML docs for `Read()` + - line 1083: missing XML docs for `Seek()` + - line 1088: missing XML docs for `SetLength()` diff --git a/docs/testing/real-world-scripts.md b/docs/testing/real-world-scripts.md index afe6e75c3..fc9473a07 100644 --- a/docs/testing/real-world-scripts.md +++ b/docs/testing/real-world-scripts.md @@ -21,7 +21,7 @@ NovaSharp executes a curated set of third-party Lua scripts to spot regressions - Add new scripts under `src/tests/WallstopStudios.NovaSharp.Interpreter.Tests/Fixtures/RealWorld/` with the upstream `LICENSE`. - Extend `RealWorldScriptTests` with a descriptive `TestCaseData` entry that exercises a behaviour NovaSharp must support. - Update the table above (and `docs/ThirdPartyLicenses.md`) with the script name, tag/commit, license, and source URL. -- Re-run `dotnet test src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj -c Release --filter RealWorld` after every corpus change. +- Re-run `./scripts/test/quick.sh -c RealWorld` after every corpus change. ## Completed Setup diff --git a/global.json b/global.json index bbd55e413..c93bc05eb 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100", + "version": "10.0.100", "rollForward": "latestMinor", "allowPrerelease": false }, diff --git a/scripts/build/README.md b/scripts/build/README.md index a59cfbf3b..eb77ddaa8 100644 --- a/scripts/build/README.md +++ b/scripts/build/README.md @@ -40,7 +40,7 @@ Use `quick.sh` for fast iterative development with incremental compilation: - `--skip-tests` / `-SkipTests`: Build only; do not execute tests. - `--skip-tool-restore` / `-SkipToolRestore`: Assume `dotnet tool restore` already ran for this checkout. -Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when the variable is unset so environments with only .NET 9 installed can still run the net8 test runner. Test logs are written to `artifacts/test-results`, matching the CI layout. +Both scripts automatically set `DOTNET_ROLL_FORWARD=Major` when the variable is unset so newer .NET runtimes can run the .NET 8 test host. Test logs are written to `artifacts/test-results`, matching the CI layout. ### Examples diff --git a/scripts/build/build.ps1 b/scripts/build/build.ps1 index 10ae48d1e..80dbb1318 100644 --- a/scripts/build/build.ps1 +++ b/scripts/build/build.ps1 @@ -51,7 +51,7 @@ else { if ([string]::IsNullOrWhiteSpace($env:DOTNET_ROLL_FORWARD)) { $env:DOTNET_ROLL_FORWARD = "Major" - Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 hosts can run the net8 test runner." + Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run the .NET 8 test host." } # Suppress TUnit ASCII banner and telemetry messages @@ -96,9 +96,8 @@ NovaSharp test results were not generated. This placeholder file ensures CI arti Set-Content -Path $placeholderPath -Value $placeholderContent Write-Host "Running tests for $TestProject..." - # Microsoft.Testing.Platform options (--report-trx, --results-directory) must be passed after -- - dotnet test $TestProject -c $Configuration --no-build ` - -- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx ` + dotnet test --project $TestProject -c $Configuration --no-build ` + --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx ` --results-directory $resultsDir if ($LASTEXITCODE -ne 0) { throw "dotnet test $TestProject failed with exit code $LASTEXITCODE." diff --git a/scripts/build/build.sh b/scripts/build/build.sh index 0ce4dbc72..9cdb5e320 100755 --- a/scripts/build/build.sh +++ b/scripts/build/build.sh @@ -83,7 +83,7 @@ EOF if [[ -z "${DOTNET_ROLL_FORWARD:-}" ]]; then export DOTNET_ROLL_FORWARD="Major" - echo "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 hosts can run the net8 test runner." + echo "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run the .NET 8 test host." fi # Suppress TUnit ASCII banner and telemetry messages @@ -113,14 +113,8 @@ dotnet build "$solution" -c "$configuration" -m "${build_restore_flag[@]}" if (( run_tests )); then echo "Running tests for $test_project..." - test_restore_flag=() - if (( ! restore_packages )); then - test_restore_flag=(--no-restore) - fi - # Microsoft.Testing.Platform options (--report-trx, --results-directory) must be passed after -- - dotnet test "$test_project" -c "$configuration" --no-build \ - "${test_restore_flag[@]}" \ - -- --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx \ + dotnet test --project "$test_project" -c "$configuration" --no-build \ + --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx \ --results-directory "$test_results_dir" rm -f "$test_results_placeholder" fi diff --git a/scripts/coverage/coverage.ps1 b/scripts/coverage/coverage.ps1 index 18a2b7855..ee33ded58 100644 --- a/scripts/coverage/coverage.ps1 +++ b/scripts/coverage/coverage.ps1 @@ -120,7 +120,7 @@ else { if ([string]::IsNullOrWhiteSpace($env:DOTNET_ROLL_FORWARD)) { $env:DOTNET_ROLL_FORWARD = "Major" - Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 runtimes can host net8 test runners." + Write-Host "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run .NET 8 test hosts." } # Suppress TUnit ASCII banner and telemetry messages @@ -221,8 +221,7 @@ try { $tunitCoverageDir = Join-Path $coverageRoot "tunit" New-Item -ItemType Directory -Force -Path $tunitCoverageDir | Out-Null $tunitCoverageBase = Join-Path $tunitCoverageDir "coverage" - # Use 'dotnet run' instead of 'dotnet test' because Microsoft.Testing.Platform - # (configured in global.json) does not support 'dotnet test --project' syntax. + # Launch the TUnit test application directly through coverlet. $tunitTargetArgs = "run --project `"$tunitRunnerProject`" -c $Configuration --no-build" $remoteDebuggerTargetArgs = diff --git a/scripts/coverage/coverage.sh b/scripts/coverage/coverage.sh index 699ddce2a..c3b5da76e 100755 --- a/scripts/coverage/coverage.sh +++ b/scripts/coverage/coverage.sh @@ -165,7 +165,7 @@ trap 'popd >/dev/null' EXIT if [[ -z "${DOTNET_ROLL_FORWARD:-}" ]]; then export DOTNET_ROLL_FORWARD=Major - log "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so .NET 9 runtimes can host net8 test runners." + log "DOTNET_ROLL_FORWARD not set; defaulting to 'Major' so newer .NET runtimes can run .NET 8 test hosts." fi # Suppress TUnit ASCII banner and telemetry messages @@ -252,8 +252,7 @@ mkdir -p "$tunit_coverage_dir" tunit_coverage_base="$tunit_coverage_dir/coverage" tunit_coverage_json="${tunit_coverage_base}.json" -# Use 'run' instead of 'test' because Microsoft.Testing.Platform -# (configured in global.json) does not support 'dotnet test ' syntax. +# Launch the TUnit test application directly through coverlet. tunit_target_args=( run --project "$tunit_runner_project" -c "$configuration" diff --git a/scripts/test/quick.sh b/scripts/test/quick.sh index 00e8d16be..008a265d4 100755 --- a/scripts/test/quick.sh +++ b/scripts/test/quick.sh @@ -122,7 +122,7 @@ export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_NOLOGO=1 export TESTINGPLATFORM_NOBANNER=1 -# Ensure .NET 9 can run .NET 8 test host +# Allow newer .NET runtimes to run the .NET 8 test host if [[ -z "${DOTNET_ROLL_FORWARD:-}" ]]; then export DOTNET_ROLL_FORWARD="Major" fi diff --git a/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugServer.cs b/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugServer.cs index df42d91b3..debf12c17 100644 --- a/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugServer.cs +++ b/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugServer.cs @@ -680,9 +680,8 @@ private static string GetWatchElementName(WatchType watchType) return known; } - return WatchElementNameCache.GetOrAdd( - watchType, - static wt => InvariantString.ToLowerInvariantIfNeeded(wt.ToString()) + return WatchElementNameCache.GetOrAdd(watchType, static wt => + InvariantString.ToLowerInvariantIfNeeded(wt.ToString()) ); } } diff --git a/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugWebHost.cs b/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugWebHost.cs index 417f6eaa9..96c10c83e 100644 --- a/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugWebHost.cs +++ b/src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/DebugWebHost.cs @@ -47,10 +47,9 @@ private static byte[] GetResourceData(string resourceName) { Assembly assembly = Assembly.GetExecutingAssembly(); - using Stream stream = - assembly.GetManifestResourceStream( - "WallstopStudios.NovaSharp.RemoteDebugger.Resources." + resourceName - ) + using Stream stream = assembly.GetManifestResourceStream( + "WallstopStudios.NovaSharp.RemoteDebugger.Resources." + resourceName + ) ?? throw new InvalidOperationException( $"Embedded resource '{resourceName}' could not be located." ); diff --git a/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/NovaSharpVsCodeDebugServer.cs b/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/NovaSharpVsCodeDebugServer.cs index ab2e0225b..4e9976c04 100644 --- a/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/NovaSharpVsCodeDebugServer.cs +++ b/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/NovaSharpVsCodeDebugServer.cs @@ -362,42 +362,39 @@ private void ListenThread(TcpListener serverSocket) clientSocket.RemoteEndPoint ); - SpawnThread( - "VsCodeDebugSession_" + sessionId, - () => + SpawnThread("VsCodeDebugSession_" + sessionId, () => + { + using (NetworkStream networkStream = new NetworkStream(clientSocket)) { - using (NetworkStream networkStream = new NetworkStream(clientSocket)) + try + { + RunSession(sessionId, networkStream); + } + catch (InterpreterException ex) + { + Log( + "[{0}] : Interpreter error : {1}", + sessionId, + ex.DecoratedMessage ?? ex.Message + ); + } + catch (IOException ex) { - try - { - RunSession(sessionId, networkStream); - } - catch (InterpreterException ex) - { - Log( - "[{0}] : Interpreter error : {1}", - sessionId, - ex.DecoratedMessage ?? ex.Message - ); - } - catch (IOException ex) - { - Log("[{0}] : IO error : {1}", sessionId, ex.Message); - } - catch (InvalidOperationException ex) - { - Log("[{0}] : Session error : {1}", sessionId, ex.Message); - } + Log("[{0}] : IO error : {1}", sessionId, ex.Message); } + catch (InvalidOperationException ex) + { + Log("[{0}] : Session error : {1}", sessionId, ex.Message); + } + } #if DOTNET_CORE - clientSocket.Dispose(); + clientSocket.Dispose(); #else - clientSocket.Close(); + clientSocket.Close(); #endif - Log("[{0}] : Client connection closed", sessionId); - } - ); + Log("[{0}] : Client connection closed", sessionId); + }); } } catch (SocketException e) diff --git a/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/SDK/Utilities.cs b/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/SDK/Utilities.cs index 8d94586ba..b75b02c66 100644 --- a/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/SDK/Utilities.cs +++ b/src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/SDK/Utilities.cs @@ -63,24 +63,21 @@ public static string ExpandVariables( variables = new { }; } Type type = variables.GetType(); - return Variable.Replace( - format, - match => + return Variable.Replace(format, match => + { + string name = match.Groups[1].Value; + if (!underscoredOnly || name.StartsWith('_')) { - string name = match.Groups[1].Value; - if (!underscoredOnly || name.StartsWith('_')) + PropertyInfo property = Framework.Do.GetProperty(type, name); + if (property != null) { - PropertyInfo property = Framework.Do.GetProperty(type, name); - if (property != null) - { - object value = property.GetValue(variables, null); - return value.ToString(); - } - return '{' + name + ": not found}"; + object value = property.GetValue(variables, null); + return value.ToString(); } - return match.Groups[0].Value; + return '{' + name + ": not found}"; } - ); + return match.Groups[0].Value; + }); } /** diff --git a/src/interop/WallstopStudios.NovaSharp.Interop.Generator/LuaInteropSourceGenerator.cs b/src/interop/WallstopStudios.NovaSharp.Interop.Generator/LuaInteropSourceGenerator.cs index a2054af2f..f9b42b71f 100644 --- a/src/interop/WallstopStudios.NovaSharp.Interop.Generator/LuaInteropSourceGenerator.cs +++ b/src/interop/WallstopStudios.NovaSharp.Interop.Generator/LuaInteropSourceGenerator.cs @@ -31,13 +31,11 @@ public void Initialize(IncrementalGeneratorInitializationContext context) ) .Where(static model => model != null); - context.RegisterSourceOutput( - luaObjects, - static (sourceContext, model) => - sourceContext.AddSource( - model.HintName, - SourceText.From(EmitSource(model), Encoding.UTF8) - ) + context.RegisterSourceOutput(luaObjects, static (sourceContext, model) => + sourceContext.AddSource( + model.HintName, + SourceText.From(EmitSource(model), Encoding.UTF8) + ) ); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Api/LuaEngineAdapters.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Api/LuaEngineAdapters.cs index 0948f534e..36c20962a 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Api/LuaEngineAdapters.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Api/LuaEngineAdapters.cs @@ -78,8 +78,8 @@ internal sealed class LuaRandomProviderAdapter : IRandomProvider /// public LuaRandomProviderAdapter(ILuaRandomProvider randomProvider) { - _randomProvider = - randomProvider ?? throw new ArgumentNullException(nameof(randomProvider)); + _randomProvider = randomProvider + ?? throw new ArgumentNullException(nameof(randomProvider)); } /// diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/CoroutineModule.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/CoroutineModule.cs index 249f1e872..ac63dbb1d 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/CoroutineModule.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/CoroutineModule.cs @@ -82,9 +82,8 @@ CallbackArgumentsView args } LuaValue handle = Create(executionContext, args); - return LuaValue.NewCallbackView( - executionContext.Script, - callArgs => ResumeCoroutineWithArguments(handle.Coroutine, callArgs, 0) + return LuaValue.NewCallbackView(executionContext.Script, callArgs => + ResumeCoroutineWithArguments(handle.Coroutine, callArgs, 0) ); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/DebugModule.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/DebugModule.cs index 46c3a9647..919c099c4 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/DebugModule.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/DebugModule.cs @@ -1597,16 +1597,13 @@ out CallStackItem frame private static LuaValue GetUpvalueIdentifier(Script script, UpvalueCell upvalueSlot) { return UpvalueIdentifiers - .GetValue( - upvalueSlot, - slot => new UpvalueIdentifierValue( - UserData.Create( - script, - new UpvalueIdentifier(slot), - UpvalueIdentifierDescriptorInstance - ) + .GetValue(upvalueSlot, slot => new UpvalueIdentifierValue( + UserData.Create( + script, + new UpvalueIdentifier(slot), + UpvalueIdentifierDescriptorInstance ) - ) + )) .Value; } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/IoModule.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/IoModule.cs index 9759a6a61..fa9986cbc 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/IoModule.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/IoModule.cs @@ -243,9 +243,8 @@ private static LuaValue Close( CallbackArgumentsView args ) { - FileUserDataBase outp = - args[0] - .CheckUserDataType("close", 0, TypeValidationOptions.AllowNil) + FileUserDataBase outp = args[0] + .CheckUserDataType("close", 0, TypeValidationOptions.AllowNil) ?? GetDefaultFile(executionContext, StandardFileType.StdOut); return outp.Close(executionContext, args); } @@ -277,9 +276,8 @@ private static LuaValue Flush( CallbackArgumentsView args ) { - FileUserDataBase outp = - args[0] - .CheckUserDataType("close", 0, TypeValidationOptions.AllowNil) + FileUserDataBase outp = args[0] + .CheckUserDataType("close", 0, TypeValidationOptions.AllowNil) ?? GetDefaultFile(executionContext, StandardFileType.StdOut); outp.Flush(); return LuaValue.True; diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/StringModule.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/StringModule.cs index c2e7248fd..79092c542 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/StringModule.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/CoreLib/StringModule.cs @@ -69,93 +69,73 @@ private static void RegisterStringArithmeticMetamethods(Table stringMetatable) // __add: a + b stringMetatable.Set( Metamethods.Add, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => - StringBinaryArithmetic(ctx, args, Metamethods.Add, LuaNumber.Add) + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + StringBinaryArithmetic(ctx, args, Metamethods.Add, LuaNumber.Add) ) ); // __sub: a - b stringMetatable.Set( Metamethods.Sub, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => - StringBinaryArithmetic(ctx, args, Metamethods.Sub, LuaNumber.Subtract) + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + StringBinaryArithmetic(ctx, args, Metamethods.Sub, LuaNumber.Subtract) ) ); // __mul: a * b stringMetatable.Set( Metamethods.Mul, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => - StringBinaryArithmetic(ctx, args, Metamethods.Mul, LuaNumber.Multiply) + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + StringBinaryArithmetic(ctx, args, Metamethods.Mul, LuaNumber.Multiply) ) ); // __div: a / b stringMetatable.Set( Metamethods.Div, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => - StringBinaryArithmetic(ctx, args, Metamethods.Div, LuaNumber.Divide) + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + StringBinaryArithmetic(ctx, args, Metamethods.Div, LuaNumber.Divide) ) ); // __mod: a % b stringMetatable.Set( Metamethods.Mod, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => - StringBinaryArithmetic( - ctx, - args, - Metamethods.Mod, - static (a, b) => LuaNumber.Modulo(a, b, LuaCompatibilityVersion.Lua54) - ) + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + StringBinaryArithmetic(ctx, args, Metamethods.Mod, static (a, b) => + LuaNumber.Modulo(a, b, LuaCompatibilityVersion.Lua54) + ) ) ); // __pow: a ^ b stringMetatable.Set( Metamethods.Pow, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => - StringBinaryArithmetic(ctx, args, Metamethods.Pow, LuaNumber.Power) + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + StringBinaryArithmetic(ctx, args, Metamethods.Pow, LuaNumber.Power) ) ); // __idiv: a // b (floor division) stringMetatable.Set( Metamethods.IDiv, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => - StringBinaryArithmetic(ctx, args, Metamethods.IDiv, LuaNumber.FloorDivide) + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + StringBinaryArithmetic(ctx, args, Metamethods.IDiv, LuaNumber.FloorDivide) ) ); // __unm: -a (unary minus) stringMetatable.Set( Metamethods.Unm, - LuaValue.NewCallbackView( - ownerScript, - static (ctx, args) => + LuaValue.NewCallbackView(ownerScript, static (ctx, args) => + { + LuaNumber? a = CoerceToLuaNumber(args[0]); + if (!a.HasValue) { - LuaNumber? a = CoerceToLuaNumber(args[0]); - if (!a.HasValue) - { - throw ScriptRuntimeException.ArithmeticOnNonNumber(args[0]); - } - return LuaValue.NewNumber(LuaNumber.Negate(a.Value)); + throw ScriptRuntimeException.ArithmeticOnNonNumber(args[0]); } - ) + return LuaValue.NewNumber(LuaNumber.Negate(a.Value)); + }) ); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/DataTypes/DataType.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/DataTypes/DataType.cs index 445569a3e..1f6979988 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/DataTypes/DataType.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/DataTypes/DataType.cs @@ -175,9 +175,8 @@ public static string ToLuaDebuggerString(this DataType type) return known; } - return UnknownTypeCache.GetOrAdd( - type, - static t => InvariantString.ToLowerInvariantIfNeeded(t.ToString()) + return UnknownTypeCache.GetOrAdd(type, static t => + InvariantString.ToLowerInvariantIfNeeded(t.ToString()) ); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Diagnostics/PerformanceStatistics.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Diagnostics/PerformanceStatistics.cs index 4f9558569..7b7d34b72 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Diagnostics/PerformanceStatistics.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Diagnostics/PerformanceStatistics.cs @@ -61,8 +61,7 @@ public bool Enabled { for (int i = 0; i < (int)PerformanceCounter.LastValue; i++) { - _stopwatches[i] = - GlobalStopwatches[i] + _stopwatches[i] = GlobalStopwatches[i] ?? new PerformanceStopwatch((PerformanceCounter)i, _clock); } } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Errors/ScriptRuntimeException.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Errors/ScriptRuntimeException.cs index c1f679c92..6a2ff6a75 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Errors/ScriptRuntimeException.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Errors/ScriptRuntimeException.cs @@ -778,9 +778,8 @@ private static string GetCoroutineStateName(CoroutineState state) return known; } - return CoroutineStateNameCache.GetOrAdd( - state, - static s => InvariantString.ToLowerInvariantIfNeeded(s.ToString()) + return CoroutineStateNameCache.GetOrAdd(state, static s => + InvariantString.ToLowerInvariantIfNeeded(s.ToString()) ); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/BasicDescriptors/DispatchingUserDataDescriptor.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/BasicDescriptors/DispatchingUserDataDescriptor.cs index 6cb6cdeac..e7f8752e2 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/BasicDescriptors/DispatchingUserDataDescriptor.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/BasicDescriptors/DispatchingUserDataDescriptor.cs @@ -854,12 +854,10 @@ private static int PerformComparison(object obj, object p1, object p2) { if (obj is IComparable comp) { - return LuaValue.NewCallback( - script, - (context, args) => - LuaValue.NewBoolean( - PerformComparison(obj, args[0].ToObject(), args[1].ToObject()) <= 0 - ) + return LuaValue.NewCallback(script, (context, args) => + LuaValue.NewBoolean( + PerformComparison(obj, args[0].ToObject(), args[1].ToObject()) <= 0 + ) ); } @@ -870,12 +868,10 @@ private static int PerformComparison(object obj, object p1, object p2) { if (obj is IComparable comp) { - return LuaValue.NewCallback( - script, - (context, args) => - LuaValue.NewBoolean( - PerformComparison(obj, args[0].ToObject(), args[1].ToObject()) < 0 - ) + return LuaValue.NewCallback(script, (context, args) => + LuaValue.NewBoolean( + PerformComparison(obj, args[0].ToObject(), args[1].ToObject()) < 0 + ) ); } @@ -906,10 +902,8 @@ private static int PerformComparison(object obj, object p1, object p2) private static LuaValue MultiDispatchEqual(Script script, object obj) { - return LuaValue.NewCallback( - script, - (context, args) => - LuaValue.NewBoolean(CheckEquality(obj, args[0].ToObject(), args[1].ToObject())) + return LuaValue.NewCallback(script, (context, args) => + LuaValue.NewBoolean(CheckEquality(obj, args[0].ToObject(), args[1].ToObject())) ); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs index 03cf1788e..96e37adca 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/ReflectionMemberDescriptors/EventMemberDescriptor.cs @@ -323,25 +323,22 @@ CallbackArguments args private void RegisterCallback(object o) { - _delegates.GetOrCreate( - o, - () => - { - Delegate d = CreateDelegate(o); + _delegates.GetOrCreate(o, () => + { + Delegate d = CreateDelegate(o); #if NETFX_CORE - Delegate handler = d.GetMethodInfo() - .CreateDelegate(EventInfo.EventHandlerType, d.Target); + Delegate handler = d.GetMethodInfo() + .CreateDelegate(EventInfo.EventHandlerType, d.Target); #else - Delegate handler = Delegate.CreateDelegate( - EventInfo.EventHandlerType, - d.Target, - d.Method - ); + Delegate handler = Delegate.CreateDelegate( + EventInfo.EventHandlerType, + d.Target, + d.Method + ); #endif - _add.Invoke(o, new object[] { handler }); - return handler; - } - ); + _add.Invoke(o, new object[] { handler }); + return handler; + }); } private void UnregisterCallback(object o) diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/StandardEnumUserDataDescriptor.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/StandardEnumUserDataDescriptor.cs index 5942c3957..8efc34075 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/StandardEnumUserDataDescriptor.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/StandardDescriptors/StandardEnumUserDataDescriptor.cs @@ -305,11 +305,8 @@ private LuaValue PerformBinaryOperationS( Func operation ) { - return PerformBinaryOperationS( - funcName, - ctx, - args, - (v1, v2) => CreateValueSigned(operation(v1, v2)) + return PerformBinaryOperationS(funcName, ctx, args, (v1, v2) => + CreateValueSigned(operation(v1, v2)) ); } @@ -320,11 +317,8 @@ private LuaValue PerformBinaryOperationU( Func operation ) { - return PerformBinaryOperationU( - funcName, - ctx, - args, - (v1, v2) => CreateValueUnsigned(operation(v1, v2)) + return PerformBinaryOperationU(funcName, ctx, args, (v1, v2) => + CreateValueUnsigned(operation(v1, v2)) ); } @@ -429,20 +423,14 @@ internal LuaValue CallbackHasAll(ScriptExecutionContext ctx, CallbackArguments a { if (IsUnsigned) { - return PerformBinaryOperationU( - "hasAll", - ctx, - args, - (v1, v2) => LuaValue.NewBoolean((v1 & v2) == v2) + return PerformBinaryOperationU("hasAll", ctx, args, (v1, v2) => + LuaValue.NewBoolean((v1 & v2) == v2) ); } else { - return PerformBinaryOperationS( - "hasAll", - ctx, - args, - (v1, v2) => LuaValue.NewBoolean((v1 & v2) == v2) + return PerformBinaryOperationS("hasAll", ctx, args, (v1, v2) => + LuaValue.NewBoolean((v1 & v2) == v2) ); } } @@ -454,20 +442,14 @@ internal LuaValue CallbackHasAny(ScriptExecutionContext ctx, CallbackArguments a { if (IsUnsigned) { - return PerformBinaryOperationU( - "hasAny", - ctx, - args, - (v1, v2) => LuaValue.NewBoolean((v1 & v2) != 0) + return PerformBinaryOperationU("hasAny", ctx, args, (v1, v2) => + LuaValue.NewBoolean((v1 & v2) != 0) ); } else { - return PerformBinaryOperationS( - "hasAny", - ctx, - args, - (v1, v2) => LuaValue.NewBoolean((v1 & v2) != 0) + return PerformBinaryOperationS("hasAny", ctx, args, (v1, v2) => + LuaValue.NewBoolean((v1 & v2) != 0) ); } } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/UserDataRegistries/TypeDescriptorRegistry.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/UserDataRegistries/TypeDescriptorRegistry.cs index 165d98552..a6c4fd00a 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/UserDataRegistries/TypeDescriptorRegistry.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Interop/UserDataRegistries/TypeDescriptorRegistry.cs @@ -601,8 +601,8 @@ internal static IRegistrationPolicy RegistrationPolicy get { return CurrentState.RegistrationPolicy; } set { - CurrentState.RegistrationPolicy = - value ?? throw new ArgumentNullException(nameof(value)); + CurrentState.RegistrationPolicy = value + ?? throw new ArgumentNullException(nameof(value)); } } } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Loaders/ScriptLoaderBase.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Loaders/ScriptLoaderBase.cs index 826c81518..c80c36390 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Loaders/ScriptLoaderBase.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Loaders/ScriptLoaderBase.cs @@ -227,12 +227,11 @@ public static IReadOnlyList UnpackStringPaths(string str) /// public static IReadOnlyList GetDefaultEnvironmentPaths() { - IReadOnlyList paths = - TryUnpackEnvironmentVariable( - Script.GlobalOptions.Platform.GetEnvironmentVariable( - NovaSharpPathEnvironmentVariable - ) + IReadOnlyList paths = TryUnpackEnvironmentVariable( + Script.GlobalOptions.Platform.GetEnvironmentVariable( + NovaSharpPathEnvironmentVariable ) + ) ?? TryUnpackEnvironmentVariable( Script.GlobalOptions.Platform.GetEnvironmentVariable("LUA_PATH") ); @@ -270,18 +269,14 @@ private static string NormalizeModuleName(string modname) return modname; } - return string.Create( - modname.Length, - modname, - static (destination, source) => + return string.Create(modname.Length, modname, static (destination, source) => + { + for (int i = 0; i < destination.Length; i++) { - for (int i = 0; i < destination.Length; i++) - { - char c = source[i]; - destination[i] = c == '.' ? '/' : c; - } + char c = source[i]; + destination[i] = c == '.' ? '/' : c; } - ); + }); } private static IReadOnlyList TryUnpackEnvironmentVariable(string value) diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifest.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifest.cs index b334288c0..99a7c5960 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifest.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifest.cs @@ -50,8 +50,7 @@ public static ModManifest Parse(string json) throw new ArgumentException("Manifest JSON cannot be empty.", nameof(json)); } - ManifestModel model = - JsonSerializer.Deserialize(json, SerializerOptions) + ManifestModel model = JsonSerializer.Deserialize(json, SerializerOptions) ?? throw new InvalidDataException("Manifest JSON resolved to an empty document."); return FromModel(model); @@ -67,9 +66,10 @@ public static ModManifest Load(Stream stream) throw new ArgumentNullException(nameof(stream)); } - ManifestModel model = - JsonSerializer.Deserialize(stream, SerializerOptions) - ?? throw new InvalidDataException("Manifest JSON resolved to an empty document."); + ManifestModel model = JsonSerializer.Deserialize( + stream, + SerializerOptions + ) ?? throw new InvalidDataException("Manifest JSON resolved to an empty document."); return FromModel(model); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifestCompatibility.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifestCompatibility.cs index a126f55e6..3f3b0672a 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifestCompatibility.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modding/ModManifestCompatibility.cs @@ -92,8 +92,8 @@ public static bool TryApplyFromDirectory( using Stream stream = fs.OpenRead(manifestPath); ModManifest manifest = ModManifest.Load(stream); - LuaCompatibilityVersion hostVersion = - hostCompatibility ?? Script.GlobalOptions.CompatibilityVersion; + LuaCompatibilityVersion hostVersion = hostCompatibility + ?? Script.GlobalOptions.CompatibilityVersion; manifest.ApplyCompatibility(options, hostVersion, warningSink); diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modules/ModuleRegister.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modules/ModuleRegister.cs index b8b726717..a5ca07eab 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modules/ModuleRegister.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Modules/ModuleRegister.cs @@ -430,8 +430,8 @@ public static Table RegisterModuleType(this Table gtable, Type t) ); Table table = CreateModuleNamespace(gtable, descriptor.ModuleNamespace); Script ownerScript = table.OwnerScript; - LuaCompatibilityVersion scriptVersion = - ownerScript?.CompatibilityVersion ?? Script.GlobalOptions.CompatibilityVersion; + LuaCompatibilityVersion scriptVersion = ownerScript?.CompatibilityVersion + ?? Script.GlobalOptions.CompatibilityVersion; ModuleMethodRegistration[] methodActions = descriptor.MethodActions; for (int i = 0; i < methodActions.Length; i++) diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/DotNetCorePlatformAccessor.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/DotNetCorePlatformAccessor.cs index decca6cef..8eb18bd94 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/DotNetCorePlatformAccessor.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/DotNetCorePlatformAccessor.cs @@ -200,8 +200,7 @@ public override int ExecuteCommand(string cmdline) try { - using Process process = - Process.Start(startInfo) + using Process process = Process.Start(startInfo) ?? throw new InvalidOperationException("Failed to start command process."); process.WaitForExit(); return process.ExitCode; diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/PlatformAutoDetector.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/PlatformAutoDetector.cs index dcaccb8ad..7ff94eff3 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/PlatformAutoDetector.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Platforms/PlatformAutoDetector.cs @@ -169,8 +169,7 @@ private static void AutoDetectPlatformFlags() Assembly[] assemblyOverride = TestHooks .GetAssemblyEnumerationOverride() ?.Invoke(); - Assembly[] loadedAssemblies = - assemblyOverride?.Where(a => a != null).ToArray() + Assembly[] loadedAssemblies = assemblyOverride?.Where(a => a != null).ToArray() ?? AppDomain.CurrentDomain.GetAssemblies(); bool unityTypeFound = false; diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/REPL/ReplInterpreterScriptLoader.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/REPL/ReplInterpreterScriptLoader.cs index 942793f08..0b97f8a24 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/REPL/ReplInterpreterScriptLoader.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/REPL/ReplInterpreterScriptLoader.cs @@ -36,8 +36,7 @@ public ReplInterpreterScriptLoader() /// Delegate used to read environment variables (defaults to ). protected ReplInterpreterScriptLoader(Func environmentVariableProvider) { - _environmentVariableProvider = - environmentVariableProvider + _environmentVariableProvider = environmentVariableProvider ?? throw new ArgumentNullException(nameof(environmentVariableProvider)); ModulePaths = TryLoadEnvironmentPaths(NovaSharpPathEnvironmentVariable); diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Script.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Script.cs index 85947968a..d8bd60666 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Script.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Script.cs @@ -498,8 +498,8 @@ public Script(CoreModules coreModules, ScriptOptions options) } _timeProvider = Options.TimeProvider ?? SystemTimeProvider.Instance; - _randomProvider = - Options.RandomProvider ?? CreateDefaultRandomProvider(Options.CompatibilityVersion); + _randomProvider = Options.RandomProvider + ?? CreateDefaultRandomProvider(Options.CompatibilityVersion); _startTimeUtc = _timeProvider.GetUtcNow().UtcDateTime; // Initialize allocation tracker if memory or coroutine limits are configured @@ -588,8 +588,8 @@ internal set { if (ScopedGlobalOptions.Value != null) { - ScopedGlobalOptions.Value.Options = - value ?? throw new ArgumentNullException(nameof(value)); + ScopedGlobalOptions.Value.Options = value + ?? throw new ArgumentNullException(nameof(value)); } else { @@ -1457,9 +1457,8 @@ internal LuaValue ExecuteTrustedCompiledFunction(LuaValue function) private LuaValue ExecuteLuaFunctionWithoutArguments(LuaValue function) { - return ExecuteWithCompatibilityGuard( - (_mainProcessor, function), - static state => state._mainProcessor.CallFunctionWithoutArguments(state.function) + return ExecuteWithCompatibilityGuard((_mainProcessor, function), static state => + state._mainProcessor.CallFunctionWithoutArguments(state.function) ); } @@ -1475,9 +1474,8 @@ internal LuaValue ExecuteTrustedCompiledFunction(LuaValue function, LuaValue arg return CallValues(function, arg); } - return ExecuteWithCompatibilityGuard( - (_mainProcessor, function, arg), - static state => state._mainProcessor.Call(state.function, state.arg) + return ExecuteWithCompatibilityGuard((_mainProcessor, function, arg), static state => + state._mainProcessor.Call(state.function, state.arg) ); } @@ -1939,8 +1937,7 @@ out Execution.CachedChunk cached return MakeClosure(cached._entryPointAddress, globalTable ?? _globalTable); } - string chunkName = - codeFriendlyName + string chunkName = codeFriendlyName ?? ZString.Concat("chunk_", _sources.Count.ToString(CultureInfo.InvariantCulture)); SourceCode source = new(codeFriendlyName ?? chunkName, code, _sources.Count, this); @@ -2043,8 +2040,7 @@ private LuaValue LoadStreamCore( return LoadString(scriptCode, globalTable, codeFriendlyName); } - string chunkName = - codeFriendlyName + string chunkName = codeFriendlyName ?? ZString.Concat("dump_", _sources.Count.ToString(CultureInfo.InvariantCulture)); SourceCode source = new( @@ -2536,9 +2532,8 @@ internal LuaValue CallValues(LuaValue function, LuaValue arg) return CallNonFunction(function, arg); } - return ExecuteWithCompatibilityGuard( - (_mainProcessor, function, arg), - static state => state._mainProcessor.Call(state.function, state.arg) + return ExecuteWithCompatibilityGuard((_mainProcessor, function, arg), static state => + state._mainProcessor.Call(state.function, state.arg) ); } @@ -3112,9 +3107,8 @@ out LuaValue directResult return ExecuteLuaFunctionWithoutArguments(function); } - return ExecuteWithCompatibilityGuard( - (_mainProcessor, function, args), - static state => state._mainProcessor.Call(state.function, state.args) + return ExecuteWithCompatibilityGuard((_mainProcessor, function, args), static state => + state._mainProcessor.Call(state.function, state.args) ); } diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Tree/Statements/AssignmentStatement.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Tree/Statements/AssignmentStatement.cs index 87633d491..f68f21995 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Tree/Statements/AssignmentStatement.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Tree/Statements/AssignmentStatement.cs @@ -143,8 +143,8 @@ public override void Compile(Execution.VM.ByteCode bc) private static SymbolRefAttributes ParseLocalAttributes(ScriptLoadingContext lcontext) { SymbolRefAttributes flags = default; - Script script = - lcontext.Script ?? throw new InvalidOperationException("Missing Script instance."); + Script script = lcontext.Script + ?? throw new InvalidOperationException("Missing Script instance."); LuaCompatibilityProfile profile = script.CompatibilityProfile; while (lcontext.Lexer.Current.type == TokenType.OpLessThan) diff --git a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Utilities/PathSpanExtensions.cs b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Utilities/PathSpanExtensions.cs index 11b900a64..b5fcf6d56 100644 --- a/src/runtime/WallstopStudios.NovaSharp.Interpreter/Utilities/PathSpanExtensions.cs +++ b/src/runtime/WallstopStudios.NovaSharp.Interpreter/Utilities/PathSpanExtensions.cs @@ -89,20 +89,15 @@ public static string NormalizeDirectorySeparators(this string path, char replace return path; } - return string.Create( - path.Length, - (path, replacement), - static (span, state) => + return string.Create(path.Length, (path, replacement), static (span, state) => + { + ReadOnlySpan source = state.path.AsSpan(); + for (int i = 0; i < source.Length; i++) { - ReadOnlySpan source = state.path.AsSpan(); - for (int i = 0; i < source.Length; i++) - { - char c = source[i]; - span[i] = - (c == UnixSeparator || c == WindowsSeparator) ? state.replacement : c; - } + char c = source[i]; + span[i] = (c == UnixSeparator || c == WindowsSeparator) ? state.replacement : c; } - ); + }); } } } diff --git a/src/tests/TestInfrastructure/Scopes/TempResourcesScopes.cs b/src/tests/TestInfrastructure/Scopes/TempResourcesScopes.cs index 026498ef8..53eb3f69e 100644 --- a/src/tests/TestInfrastructure/Scopes/TempResourcesScopes.cs +++ b/src/tests/TestInfrastructure/Scopes/TempResourcesScopes.cs @@ -167,8 +167,8 @@ public static TempFileScope CreateWithText( createFile: false, deleteOnDispose: deleteOnDispose ); - Encoding writerEncoding = - encoding ?? new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); + Encoding writerEncoding = encoding + ?? new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); File.WriteAllText(scope.FilePath, content ?? string.Empty, writerEncoding); return scope; } diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/DispatchingUserDataDescriptorTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/DispatchingUserDataDescriptorTUnitTests.cs index 3f26e09bf..f2c4f5818 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/DispatchingUserDataDescriptorTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/DispatchingUserDataDescriptorTUnitTests.cs @@ -879,9 +879,8 @@ public async Task OptimizeDelegatesToMembersAndMetaMembers() bool metaOptimized = false; descriptor.AddMember( "OptimizableMember", - new StubOptimizableMemberDescriptor( - "OptimizableMember", - () => memberOptimized = true + new StubOptimizableMemberDescriptor("OptimizableMember", () => + memberOptimized = true ) ); descriptor.AddMetaMember( diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/PropertyMemberDescriptorTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/PropertyMemberDescriptorTUnitTests.cs index b45a19a0e..b84ff91ad 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/PropertyMemberDescriptorTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Descriptors/PropertyMemberDescriptorTUnitTests.cs @@ -459,9 +459,8 @@ LuaCompatibilityVersion version SamplePropertiesMetadata.InstanceValue, InteropAccessMode.Reflection ); - OverrideOptimizedSetter( - descriptor, - (_, _) => throw new ArgumentException("failing reflection assignment") + OverrideOptimizedSetter(descriptor, (_, _) => + throw new ArgumentException("failing reflection assignment") ); ScriptRuntimeException exception = ExpectException(() => @@ -485,9 +484,8 @@ LuaCompatibilityVersion version SamplePropertiesMetadata.InstanceValue, InteropAccessMode.Reflection ); - OverrideOptimizedSetter( - descriptor, - (_, _) => throw new InvalidCastException("failing optimized assignment") + OverrideOptimizedSetter(descriptor, (_, _) => + throw new InvalidCastException("failing optimized assignment") ); ScriptRuntimeException exception = ExpectException(() => diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseGenRegisteredTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseGenRegisteredTUnitTests.cs index 329a2a2ae..b96acbd95 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseGenRegisteredTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseGenRegisteredTUnitTests.cs @@ -361,9 +361,8 @@ public Task RegCollGenIteratorOnObjListChangeElem() private static Task RunScriptAsync(string code, Func asserts) { - return RunScriptAsync( - code, - async (value, _) => await asserts(value).ConfigureAwait(false) + return RunScriptAsync(code, async (value, _) => + await asserts(value).ConfigureAwait(false) ); } diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseInterfaceRegisteredTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseInterfaceRegisteredTUnitTests.cs index 3e67bffa3..63e01a357 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseInterfaceRegisteredTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsBaseInterfaceRegisteredTUnitTests.cs @@ -293,9 +293,8 @@ public Task RegCollGenInterfIteratorOnObjListChangeElem() private static Task RunScriptAsync(string code, Func asserts) { - return RunScriptAsync( - code, - async (value, _) => await asserts(value).ConfigureAwait(false) + return RunScriptAsync(code, async (value, _) => + await asserts(value).ConfigureAwait(false) ); } diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsRegisteredTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsRegisteredTUnitTests.cs index 1573218bf..ec8bbcd57 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsRegisteredTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/CollectionsRegisteredTUnitTests.cs @@ -277,9 +277,8 @@ await EndToEndDynValueAssert private static Task RunScriptAsync(string code, Func asserts) { - return RunScriptAsync( - code, - async (value, _) => await asserts(value).ConfigureAwait(false) + return RunScriptAsync(code, async (value, _) => + await asserts(value).ConfigureAwait(false) ); } diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/UserDataMethodsTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/UserDataMethodsTUnitTests.cs index 8d542795b..1ee91fbee 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/UserDataMethodsTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/EndToEnd/UserDataMethodsTUnitTests.cs @@ -569,10 +569,8 @@ InteropAccessMode opt typeof(IList), v => new List() { 42, 77, 125, 13 } ); - registry.SetScriptToClrCustomConversion( - DataType.Table, - typeof(int[]), - v => (int[])ScriptToClrIntArray.Clone() + registry.SetScriptToClrCustomConversion(DataType.Table, typeof(int[]), v => + (int[])ScriptToClrIntArray.Clone() ); registry.SetClrToScriptCustomConversion( (s, v) => LuaValue.NewString(v.ToString().ToUpperInvariant()) diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Modules/StreamFileUserDataBaseTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Modules/StreamFileUserDataBaseTUnitTests.cs index 71a8d5dd6..da60866c1 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Modules/StreamFileUserDataBaseTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Modules/StreamFileUserDataBaseTUnitTests.cs @@ -1680,8 +1680,8 @@ public override bool Setvbuf(string mode) internal void TriggerFlushFailure() { - FaultyStreamWriter writer = - InnerWriter ?? throw new InvalidOperationException("Writer is not available."); + FaultyStreamWriter writer = InnerWriter + ?? throw new InvalidOperationException("Writer is not available."); writer.ThrowOnFlush = true; } diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Platforms/PlatformAutoDetectorTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Platforms/PlatformAutoDetectorTUnitTests.cs index 2e94fa9e5..0b4934071 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Platforms/PlatformAutoDetectorTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Platforms/PlatformAutoDetectorTUnitTests.cs @@ -544,30 +544,24 @@ private static class UnityAssemblyProbe { public static void EnsureLoaded() { - _ = BuildAssembly( - "UnityEngine", - module => - { - DefineEmptyType(module, "UnityEngine.AutoDetectorProbe"); - DefineEmptyType(module, "UnityEngine.PlatformProbe"); - DefineTextAssetType(module); - DefineResourcesType(module); - } - ); + _ = BuildAssembly("UnityEngine", module => + { + DefineEmptyType(module, "UnityEngine.AutoDetectorProbe"); + DefineEmptyType(module, "UnityEngine.PlatformProbe"); + DefineTextAssetType(module); + DefineResourcesType(module); + }); } public static Assembly[] GetAssemblies() { - Assembly assembly = BuildAssembly( - "UnityEngine", - module => - { - DefineEmptyType(module, "UnityEngine.AutoDetectorProbe"); - DefineEmptyType(module, "UnityEngine.PlatformProbe"); - DefineTextAssetType(module); - DefineResourcesType(module); - } - ); + Assembly assembly = BuildAssembly("UnityEngine", module => + { + DefineEmptyType(module, "UnityEngine.AutoDetectorProbe"); + DefineEmptyType(module, "UnityEngine.PlatformProbe"); + DefineTextAssetType(module); + DefineResourcesType(module); + }); return new[] { assembly }; } @@ -623,24 +617,18 @@ private static class UnityTypeProbe { public static void EnsureTypeLoaded() { - _ = BuildAssembly( - "UnityEngine.PlatformProbeAssembly", - module => - { - DefineEmptyType(module, "UnityEngine.PlatformProbe"); - } - ); + _ = BuildAssembly("UnityEngine.PlatformProbeAssembly", module => + { + DefineEmptyType(module, "UnityEngine.PlatformProbe"); + }); } public static Assembly[] GetAssemblies() { - Assembly assembly = BuildAssembly( - "UnityEngine.PlatformProbeAssembly", - module => - { - DefineEmptyType(module, "UnityEngine.PlatformProbe"); - } - ); + Assembly assembly = BuildAssembly("UnityEngine.PlatformProbeAssembly", module => + { + DefineEmptyType(module, "UnityEngine.PlatformProbe"); + }); return new[] { assembly }; } diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapRunnerTUnit.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapRunnerTUnit.cs index dc9d8289b..f477a6b73 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapRunnerTUnit.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapRunnerTUnit.cs @@ -42,8 +42,8 @@ public TapRunnerTUnit(string filename, LuaCompatibilityVersion? compatibilityVer { ArgumentNullException.ThrowIfNull(filename); _file = filename; - _compatibilityVersion = - compatibilityVersion ?? Script.GlobalOptions.CompatibilityVersion; + _compatibilityVersion = compatibilityVersion + ?? Script.GlobalOptions.CompatibilityVersion; } public static void Run( @@ -80,8 +80,8 @@ public void Run() script.Options.ScriptLoader = new FileSystemScriptLoader(); } ConfigureScriptLoader(script); - string suiteDirectory = - Path.GetDirectoryName(GetAbsoluteTestPath(_file)) ?? GetTestDirectory(); + string suiteDirectory = Path.GetDirectoryName(GetAbsoluteTestPath(_file)) + ?? GetTestDirectory(); SeedTapGlobals(script, _compatibilityVersion, suiteDirectory); string friendlyName = _file.Replace('\\', '/'); try diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapStdinHelper.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapStdinHelper.cs index b80128218..1922cf344 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapStdinHelper.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Tap/TapStdinHelper.cs @@ -251,8 +251,7 @@ string EvaluateCandidate(string basePath) return File.Exists(path) ? path : null; } - string candidate = - EvaluateCandidate(workingDirectory) + string candidate = EvaluateCandidate(workingDirectory) ?? EvaluateCandidate(testDirectory) ?? EvaluateCandidate(baseDirectory) ?? EvaluateCandidate(runtimeDirectory); diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataStructs/SystemArrayPoolTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataStructs/SystemArrayPoolTUnitTests.cs index ba6b94f7c..943187259 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataStructs/SystemArrayPoolTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataStructs/SystemArrayPoolTUnitTests.cs @@ -413,9 +413,8 @@ public async Task RentAndReturnIsThreadSafe() for (int i = 0; i < iterations; i++) { byte[] array = SystemArrayPool.Rent(128); - using PooledResource _ = new( - array, - arr => SystemArrayPool.Return(arr) + using PooledResource _ = new(array, arr => + SystemArrayPool.Return(arr) ); // Write some data diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataTypes/CallbackFunctionTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataTypes/CallbackFunctionTUnitTests.cs index f29ceb6da..fe527470e 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataTypes/CallbackFunctionTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/DataTypes/CallbackFunctionTUnitTests.cs @@ -494,14 +494,11 @@ LuaCompatibilityVersion version { Script script = new(version, CoreModulePresets.Complete); List receivedCounts = new(); - script.Globals["countArgs"] = LuaValue.NewCallbackView( - script, - args => - { - receivedCounts.Add(args.Count); - return LuaValue.FromNumber(args.Count); - } - ); + script.Globals["countArgs"] = LuaValue.NewCallbackView(script, args => + { + receivedCounts.Add(args.Count); + return LuaValue.FromNumber(args.Count); + }); // values(0) returns zero results; its expansion previously leaked a trailing void // sentinel into registered argument views, inflating every forwarded count by one. diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Debugging/DebugServiceTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Debugging/DebugServiceTUnitTests.cs index a4e2d2820..3732cbd61 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Debugging/DebugServiceTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Debugging/DebugServiceTUnitTests.cs @@ -28,13 +28,11 @@ public async Task ResetBreakpointsMarksExistingLinesAndReturnsFilteredSet() { (Script script, BreakpointRecordingDebugger debugger) = RunScriptAndAttachDebugger(); - DebugService service = - debugger.DebugService + DebugService service = debugger.DebugService ?? throw new InvalidOperationException("Debugger never received DebugService."); await Assert.That(service.OwnerScript).IsSameReferenceAs(script).ConfigureAwait(false); - SourceCode source = - debugger.LastSourceCode + SourceCode source = debugger.LastSourceCode ?? throw new InvalidOperationException("Debugger never received source code."); HashSet requested = new(debugger.RequestedBreakpoints); @@ -55,8 +53,7 @@ public async Task ResetBreakpointsMarksExistingLinesAndReturnsFilteredSet() public async Task ResetBreakpointsThrowsWhenSourceCodeIsNull() { (_, BreakpointRecordingDebugger debugger) = RunScriptAndAttachDebugger(); - DebugService service = - debugger.DebugService + DebugService service = debugger.DebugService ?? throw new InvalidOperationException("Debugger never received DebugService."); HashSet lines = new(debugger.RequestedBreakpoints); @@ -71,8 +68,7 @@ public async Task ResetBreakpointsThrowsWhenSourceCodeIsNull() public async Task ResetBreakpointsThrowsWhenLinesSetIsNull() { (_, BreakpointRecordingDebugger debugger) = RunScriptAndAttachDebugger(); - DebugService service = - debugger.DebugService + DebugService service = debugger.DebugService ?? throw new InvalidOperationException("Debugger never received DebugService."); ArgumentNullException exception = Assert.Throws(() => diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptCallTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptCallTUnitTests.cs index fe8a34dd3..84aa82d84 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptCallTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptCallTUnitTests.cs @@ -1332,9 +1332,8 @@ int arity ) { Script script = new(version, CoreModulePresets.Complete); - LuaValue target = CreateTableValuedCallChain( - script, - (_, _, _) => LuaValue.NewString("unexpected") + LuaValue target = CreateTableValuedCallChain(script, (_, _, _) => + LuaValue.NewString("unexpected") ); ArgumentException exception = Assert.Throws(() => @@ -1398,10 +1397,8 @@ int arity ) { Script script = new(version, CoreModulePresets.Complete); - LuaValue target = CreateTableValuedCallChain( - script, - (targetTable, proxyTable, args) => - SummarizeChainedCallArguments(targetTable, proxyTable, args) + LuaValue target = CreateTableValuedCallChain(script, (targetTable, proxyTable, args) => + SummarizeChainedCallArguments(targetTable, proxyTable, args) ); LuaValue result = CallLegacyCallbackWithSequentialArguments(script, target, arity); @@ -1420,10 +1417,8 @@ int arity ) { Script script = new(CoreModulePresets.Complete); - LuaValue target = CreateTableValuedCallChain( - script, - (targetTable, proxyTable, args) => - SummarizeChainedCallArguments(targetTable, proxyTable, args) + LuaValue target = CreateTableValuedCallChain(script, (targetTable, proxyTable, args) => + SummarizeChainedCallArguments(targetTable, proxyTable, args) ); LuaValue result = CallLegacyCallbackWithSequentialArguments(script, target, arity); @@ -2724,9 +2719,8 @@ LuaCompatibilityVersion version ) { Script script = new(version, CoreModulePresets.Complete); - LuaValue target = CreateTableValuedCallChain( - script, - (_, _, _) => LuaValue.NewString("unexpected") + LuaValue target = CreateTableValuedCallChain(script, (_, _, _) => + LuaValue.NewString("unexpected") ); LuaValue[] args = CreateSequentialArguments(5); @@ -2744,10 +2738,8 @@ LuaCompatibilityVersion version ) { Script script = new(version, CoreModulePresets.Complete); - LuaValue target = CreateTableValuedCallChain( - script, - (targetTable, proxyTable, args) => - SummarizeChainedCallArguments(targetTable, proxyTable, args) + LuaValue target = CreateTableValuedCallChain(script, (targetTable, proxyTable, args) => + SummarizeChainedCallArguments(targetTable, proxyTable, args) ); LuaValue[] args = CreateSequentialArguments(5); diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptLoadTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptLoadTUnitTests.cs index 43c9c31ef..b796d9e1f 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptLoadTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptLoadTUnitTests.cs @@ -834,9 +834,8 @@ public object LoadFile(string file, Table globalContext) { LoaderMode.String => Source, LoaderMode.Bytes => Encoding.UTF8.GetBytes(Source), - LoaderMode.Stream => new TrackingStream( - Encoding.UTF8.GetBytes(Source), - () => StreamDisposed = true + LoaderMode.Stream => new TrackingStream(Encoding.UTF8.GetBytes(Source), () => + StreamDisposed = true ), LoaderMode.Null => null, LoaderMode.Unsupported => new object(), diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptRunTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptRunTUnitTests.cs index f4cf1a125..2aa7df79d 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptRunTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptRunTUnitTests.cs @@ -52,13 +52,13 @@ public async Task RunFileExecutesFileContents() ? await File.ReadAllTextAsync(tempFile).ConfigureAwait(false) : ""; long fileLength = fileExists ? new FileInfo(tempFile).Length : -1; - string defaultLoaderType = - Script.DefaultOptions.ScriptLoader?.GetType().Name ?? ""; + string defaultLoaderType = Script.DefaultOptions.ScriptLoader?.GetType().Name + ?? ""; // Create a script directly to check the actual loader used Script testScript = new(); - string actualScriptLoaderType = - testScript.Options.ScriptLoader?.GetType().Name ?? ""; + string actualScriptLoaderType = testScript.Options.ScriptLoader?.GetType().Name + ?? ""; // Diagnostic context for troubleshooting CI failures string diagnostics = @@ -325,16 +325,16 @@ public async Task RunFileHandlesMultiStatementScript() public async Task RunFileScriptLoaderIsolationWorks() { // Verify the ForceFileSystemLoader scope properly isolates - string loaderBeforeScope = - Script.DefaultOptions.ScriptLoader?.GetType().Name ?? ""; + string loaderBeforeScope = Script.DefaultOptions.ScriptLoader?.GetType().Name + ?? ""; using ( PlatformDetectorOverrideScope platformScope = PlatformDetectionTestHelper.ForceFileSystemLoader() ) { - string loaderDuringScope = - Script.DefaultOptions.ScriptLoader?.GetType().Name ?? ""; + string loaderDuringScope = Script.DefaultOptions.ScriptLoader?.GetType().Name + ?? ""; await Assert .That(loaderDuringScope) .IsEqualTo(nameof(FileSystemScriptLoader)) @@ -342,8 +342,8 @@ await Assert } // After scope ends, loader should be restored - string loaderAfterScope = - Script.DefaultOptions.ScriptLoader?.GetType().Name ?? ""; + string loaderAfterScope = Script.DefaultOptions.ScriptLoader?.GetType().Name + ?? ""; await Assert.That(loaderAfterScope).IsEqualTo(loaderBeforeScope).ConfigureAwait(false); } diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptToClrConversionsTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptToClrConversionsTUnitTests.cs index cbc46b726..0bbad7df8 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptToClrConversionsTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptExecution/ScriptToClrConversionsTUnitTests.cs @@ -27,10 +27,8 @@ public async Task DynValueToObjectUsesCustomConversionResult() { using ScriptCustomConvertersScope converterScope = ScriptCustomConvertersScope.Clear( registry => - registry.SetScriptToClrCustomConversion( - DataType.String, - typeof(object), - dv => $"converted:{dv.String}" + registry.SetScriptToClrCustomConversion(DataType.String, typeof(object), dv => + $"converted:{dv.String}" ) ); @@ -568,10 +566,8 @@ public async Task DynValueToObjectOfTypeWeightReturnsCustomConverterMatch() { using ScriptCustomConvertersScope converterScope = ScriptCustomConvertersScope.Clear( registry => - registry.SetScriptToClrCustomConversion( - DataType.Boolean, - typeof(string), - dv => dv.Boolean ? "yes" : "no" + registry.SetScriptToClrCustomConversion(DataType.Boolean, typeof(string), dv => + dv.Boolean ? "yes" : "no" ) ); diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptOptionsTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptOptionsTUnitTests.cs index d1669db32..c7fc9e307 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptOptionsTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Execution/ScriptOptionsTUnitTests.cs @@ -450,8 +450,8 @@ public async Task RunFileCreatesScriptAndExecutes(LuaCompatibilityVersion versio ); // Capture diagnostic info before running for better debugging on failure - string loaderType = - Script.DefaultOptions.ScriptLoader?.GetType().Name ?? "null (no loader)"; + string loaderType = Script.DefaultOptions.ScriptLoader?.GetType().Name + ?? "null (no loader)"; string diagnosticContext = $"FilePath: {tempFile.FilePath}, LoaderType: {loaderType}, " + $"FileExists: {System.IO.File.Exists(tempFile.FilePath)}"; @@ -579,8 +579,8 @@ LuaCompatibilityVersion version ) { // Capture current loader type for diagnostics - string loaderType = - Script.DefaultOptions.ScriptLoader?.GetType().Name ?? "null (no loader)"; + string loaderType = Script.DefaultOptions.ScriptLoader?.GetType().Name + ?? "null (no loader)"; LuaValue result = Script.RunString("return 123"); diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Converters/CustomConverterRegistryTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Converters/CustomConverterRegistryTUnitTests.cs index 708015adc..deb578f6a 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Converters/CustomConverterRegistryTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Converters/CustomConverterRegistryTUnitTests.cs @@ -57,10 +57,8 @@ public async Task SetScriptToClrConversionThrowsWhenTypeExceedsConvertibleRange( DataType invalidType = (DataType)((int)LuaTypeExtensions.MaxConvertibleTypes + 1); ArgumentException exception = Assert.Throws(() => - registry.SetScriptToClrCustomConversion( - invalidType, - typeof(string), - value => value.String + registry.SetScriptToClrCustomConversion(invalidType, typeof(string), value => + value.String ) ); @@ -233,14 +231,11 @@ public async Task ObsoleteClrToScriptConversionOverloadsBridgeToScriptAwareDeleg Script script = new(); Guid sampleGuid = Guid.Parse("01234567-89ab-cdef-0123-456789abcdef"); - InvokeLegacyClrToScriptConversion( - registry, - typeof(Guid), - value => LuaValue.NewString(((Guid)value).ToString("N")) + InvokeLegacyClrToScriptConversion(registry, typeof(Guid), value => + LuaValue.NewString(((Guid)value).ToString("N")) ); - InvokeLegacyClrToScriptConversion( - registry, - value => LuaValue.NewNumber(value * 2) + InvokeLegacyClrToScriptConversion(registry, value => + LuaValue.NewNumber(value * 2) ); Func guidConverter = registry.GetClrToScriptCustomConversion( @@ -325,14 +320,11 @@ await Assert public async Task ClearRemovesAllConverters() { CustomConverterRegistry registry = new(); - registry.SetScriptToClrCustomConversion( - DataType.String, - typeof(string), - value => value.String + registry.SetScriptToClrCustomConversion(DataType.String, typeof(string), value => + value.String ); - registry.SetClrToScriptCustomConversion( - typeof(int), - (s, value) => LuaValue.NewNumber((int)value) + registry.SetClrToScriptCustomConversion(typeof(int), (s, value) => + LuaValue.NewNumber((int)value) ); registry.SetClrToScriptTryConversion( (Script _, Guid _, out LuaValue result) => @@ -472,10 +464,8 @@ public async Task ObsoleteTypedClrToScriptConversionNullBehavior() CustomConverterRegistry registry = new(); Type stringType = typeof(string); InvokeLegacyClrToScriptConversion(registry, value => LuaValue.NewNumber(value)); - InvokeLegacyClrToScriptConversion( - registry, - stringType, - value => LuaValue.NewString((string)value) + InvokeLegacyClrToScriptConversion(registry, stringType, value => + LuaValue.NewString((string)value) ); await Assert diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Descriptors/ObjectCallbackMemberDescriptorTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Descriptors/ObjectCallbackMemberDescriptorTUnitTests.cs index a6cd36927..86f5e332b 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Descriptors/ObjectCallbackMemberDescriptorTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Interop/Descriptors/ObjectCallbackMemberDescriptorTUnitTests.cs @@ -25,16 +25,13 @@ public async Task ExecuteReturnsCallbackResult() int invocationCount = 0; object capturedObject = null; int capturedArgCount = 0; - ObjectCallbackMemberDescriptor descriptor = new( - "Echo", - (obj, ctx, args) => - { - invocationCount++; - capturedObject = obj; - capturedArgCount = args?.Count ?? 0; - return LuaValue.NewNumber(42); - } - ); + ObjectCallbackMemberDescriptor descriptor = new("Echo", (obj, ctx, args) => + { + invocationCount++; + capturedObject = obj; + capturedArgCount = args?.Count ?? 0; + return LuaValue.NewNumber(42); + }); LuaValue result = descriptor.Execute(script, "host", context: null, NoOpArgs); diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Modding/ModManifestTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Modding/ModManifestTUnitTests.cs index 1fec5b482..f3e42a1a2 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Modding/ModManifestTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Modding/ModManifestTUnitTests.cs @@ -231,10 +231,8 @@ public async Task ApplyCompatibilityFallsBackToGlobalOptionsWhenHostOmitted() ); string warning = null; - manifest.ApplyCompatibility( - options, - hostCompatibility: null, - warningSink: message => warning = message + manifest.ApplyCompatibility(options, hostCompatibility: null, warningSink: message => + warning = message ); await Assert diff --git a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Tree/Expressions/BinaryOperatorExpressionTUnitTests.cs b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Tree/Expressions/BinaryOperatorExpressionTUnitTests.cs index 43cf11fd8..3163933a0 100644 --- a/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Tree/Expressions/BinaryOperatorExpressionTUnitTests.cs +++ b/src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/Units/Tree/Expressions/BinaryOperatorExpressionTUnitTests.cs @@ -1442,9 +1442,8 @@ LuaCompatibilityVersion version expr.Compile(byteCode); Instruction[] instructions = byteCode.Code.ToArray(); - int comparisonIndex = Array.FindLastIndex( - instructions, - i => i.OpCode == expectedOpCode + int comparisonIndex = Array.FindLastIndex(instructions, i => + i.OpCode == expectedOpCode ); await Assert.That(comparisonIndex).IsGreaterThan(1).ConfigureAwait(false); diff --git a/src/tooling/WallstopStudios.NovaSharp.Cli/Program.cs b/src/tooling/WallstopStudios.NovaSharp.Cli/Program.cs index 855364aa8..91dd526ea 100644 --- a/src/tooling/WallstopStudios.NovaSharp.Cli/Program.cs +++ b/src/tooling/WallstopStudios.NovaSharp.Cli/Program.cs @@ -197,8 +197,8 @@ private static bool ExecuteScriptMode(CliParseResult parseResult) private static bool ExecuteInlineMode(CliParseResult parseResult) { - LuaCompatibilityVersion luaVersion = - parseResult.LuaVersion ?? LuaCompatibilityVersion.Latest; + LuaCompatibilityVersion luaVersion = parseResult.LuaVersion + ?? LuaCompatibilityVersion.Latest; ScriptOptions options = new(Script.DefaultOptions) { diff --git a/src/tooling/WallstopStudios.NovaSharp.Hardwire/Generators/OverloadedMethodMemberDescriptorGenerator.cs b/src/tooling/WallstopStudios.NovaSharp.Hardwire/Generators/OverloadedMethodMemberDescriptorGenerator.cs index d9c1cc806..0d7cb7e72 100644 --- a/src/tooling/WallstopStudios.NovaSharp.Hardwire/Generators/OverloadedMethodMemberDescriptorGenerator.cs +++ b/src/tooling/WallstopStudios.NovaSharp.Hardwire/Generators/OverloadedMethodMemberDescriptorGenerator.cs @@ -43,14 +43,10 @@ CodeTypeMemberCollection members List initializers = new(); - generatorContext.DispatchTablePairs( - table.Get("overloads").Table, - members, - exp => - { - initializers.Add(exp); - } - ); + generatorContext.DispatchTablePairs(table.Get("overloads").Table, members, exp => + { + initializers.Add(exp); + }); CodePrimitiveExpression name = new((table["name"] as string)); CodeTypeOfExpression type = new(table["decltype"] as string); diff --git a/src/tooling/WallstopStudios.NovaSharp.Hardwire/HardwireCodeGenerationContext.cs b/src/tooling/WallstopStudios.NovaSharp.Hardwire/HardwireCodeGenerationContext.cs index 6176e514b..17c717020 100644 --- a/src/tooling/WallstopStudios.NovaSharp.Hardwire/HardwireCodeGenerationContext.cs +++ b/src/tooling/WallstopStudios.NovaSharp.Hardwire/HardwireCodeGenerationContext.cs @@ -127,17 +127,14 @@ internal void GenerateCode(Table table) throw new ArgumentNullException(nameof(table)); } - DispatchTablePairs( - table, - _kickstarterClass.Members, - (_, exp) => - _initStatements.Add( - new CodeMethodInvokeExpression( - new CodeTypeReferenceExpression(typeof(UserData)), - "RegisterType", - exp - ) + DispatchTablePairs(table, _kickstarterClass.Members, (_, exp) => + _initStatements.Add( + new CodeMethodInvokeExpression( + new CodeTypeReferenceExpression(typeof(UserData)), + "RegisterType", + exp ) + ) ); } diff --git a/src/tooling/WallstopStudios.NovaSharp.LuaBatchRunner/LuaBatchRunner.cs b/src/tooling/WallstopStudios.NovaSharp.LuaBatchRunner/LuaBatchRunner.cs index 1b8110450..fdc03ca9f 100644 --- a/src/tooling/WallstopStudios.NovaSharp.LuaBatchRunner/LuaBatchRunner.cs +++ b/src/tooling/WallstopStudios.NovaSharp.LuaBatchRunner/LuaBatchRunner.cs @@ -133,8 +133,7 @@ public int ExecuteCommand(string cmdline) TimeSpan effectiveTimeout = GetEffectiveCommandTimeout( out bool fixtureTimeoutBound ); - using Process process = - Process.Start(startInfo) + using Process process = Process.Start(startInfo) ?? throw new InvalidOperationException("Failed to start command process."); if (process.WaitForExit(effectiveTimeout)) {