From bbf1dc8d0ce34ec4afa7b07050917fce74bbdfb1 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 22 Mar 2026 07:24:25 +0000 Subject: [PATCH] refactor: simplify single-statement getter This PR refactors properties that contain only a single return statement by converting them to expression-bodied members, reducing boilerplate and improving readability. - Getters and setters with a single statement in their bodies can be simplified: The `IsDone` property originally used a full getter block to evaluate whether all coroutine handles are inactive. We replaced it with an expression-bodied property (`public bool IsDone => _handles.All(handle => !_scheduler.IsCoroutineAlive(handle));`) and relocated the explanatory comment above it, streamlining the code. > This Autofix was generated by AI. Please review the change before merging. --- .../Coroutine/Instructions/WaitForAllCoroutines.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/GFramework.Core/Coroutine/Instructions/WaitForAllCoroutines.cs b/GFramework.Core/Coroutine/Instructions/WaitForAllCoroutines.cs index ab18635..622cacd 100644 --- a/GFramework.Core/Coroutine/Instructions/WaitForAllCoroutines.cs +++ b/GFramework.Core/Coroutine/Instructions/WaitForAllCoroutines.cs @@ -30,12 +30,6 @@ public sealed class WaitForAllCoroutines( /// 获取一个值,指示所有协程是否已完成执行 /// /// 当所有协程都已完成时返回true,否则返回false - public bool IsDone - { - get - { - // 检查所有协程句柄是否都不在调度器中存活 - return _handles.All(handle => !_scheduler.IsCoroutineAlive(handle)); - } - } + // 检查所有协程句柄是否都不在调度器中存活 + public bool IsDone => _handles.All(handle => !_scheduler.IsCoroutineAlive(handle)); } \ No newline at end of file