refactor(godot): 将异步方法重命名为遵循Async约定的方法名#71
Merged
Conversation
- 将WaitUntilReady方法重命名为WaitUntilReadyAsync - 将AddChildX方法重命名为AddChildXAsync - 更新所有相关文档中的方法调用引用 - 修改架构层锚点等待方法调用为异步版本 - 更新测试代码中的方法调用以匹配新的方法名 - 调整函数式异步扩展方法命名约定 - 统一所有异步扩展方法的命名规范
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| C# | Mar 5, 2026 4:49a.m. | Review ↗ | |
| Secrets | Mar 5, 2026 4:49a.m. | Review ↗ |
审阅者指南重构与 Godot 相关的异步 API 和核心异步工具,使其一致地使用 *Async 后缀,并更新扩展方法、函数式异步辅助方法、测试、架构代码和文档以匹配新的命名约定。 AddChildXAsync 与 WaitUntilReadyAsync 交互的时序图sequenceDiagram
actor GameCode
participant ParentNode as ParentNode
participant ChildNode as ChildNode
participant NodeExtensions as NodeExtensions
GameCode->>NodeExtensions: AddChildXAsync(ParentNode, ChildNode)
activate NodeExtensions
NodeExtensions->>ParentNode: AddChild(ChildNode)
NodeExtensions->>NodeExtensions: WaitUntilReadyAsync(ChildNode)
activate ChildNode
ChildNode->>ChildNode: IsInsideTree()
alt not inside tree
ChildNode->>ChildNode: ToSignal(ChildNode, Ready)
ChildNode-->>NodeExtensions: Ready signal awaited
else already inside tree
ChildNode-->>NodeExtensions: return immediately
end
deactivate ChildNode
NodeExtensions-->>GameCode: Task completed
deactivate NodeExtensions
更新后的异步扩展 API 类图classDiagram
class AsyncExtensions {
<<static>>
+Task~T~ WithTimeoutAsync~T~(Func~CancellationToken, Task~T~~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
+Task WithTimeoutAsync(Func~CancellationToken, Task~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
+Task~T~ WithFallbackAsync~T~(Task~T~ task, Func~Exception, T~ fallback)
}
class AsyncFunctionalExtensions {
<<static>>
+Task~T~ WithRetryAsync~T~(Func~Task~T~~ taskFactory, int maxRetries, TimeSpan delay, Func~Exception, bool~ shouldRetry)
}
class NodeExtensions {
<<static>>
+void FreeX(Node node)
+Task WaitUntilReadyAsync(Node node)
+Node GetRootNodeX(Node node)
+T GetOrCreateNode~T~(Node node, string path)
+Task AddChildXAsync(Node parent, Node child)
}
class Node {
+bool IsInsideTree()
+Task ToSignal(object target, string signal)
+void AddChild(Node child)
}
NodeExtensions ..> Node : extends
AsyncFunctionalExtensions ..> AsyncExtensions : uses
文件级变更
提示与命令与 Sourcery 交互
自定义你的体验访问你的 控制面板 以:
获取帮助Original review guide in EnglishReviewer's GuideRefactors Godot-related async APIs and core async utilities to consistently use the *Async suffix, updating extension methods, functional async helpers, tests, architecture code, and documentation to match the new naming convention. Sequence diagram for AddChildXAsync and WaitUntilReadyAsync interactionsequenceDiagram
actor GameCode
participant ParentNode as ParentNode
participant ChildNode as ChildNode
participant NodeExtensions as NodeExtensions
GameCode->>NodeExtensions: AddChildXAsync(ParentNode, ChildNode)
activate NodeExtensions
NodeExtensions->>ParentNode: AddChild(ChildNode)
NodeExtensions->>NodeExtensions: WaitUntilReadyAsync(ChildNode)
activate ChildNode
ChildNode->>ChildNode: IsInsideTree()
alt not inside tree
ChildNode->>ChildNode: ToSignal(ChildNode, Ready)
ChildNode-->>NodeExtensions: Ready signal awaited
else already inside tree
ChildNode-->>NodeExtensions: return immediately
end
deactivate ChildNode
NodeExtensions-->>GameCode: Task completed
deactivate NodeExtensions
Class diagram for updated async extension APIsclassDiagram
class AsyncExtensions {
<<static>>
+Task~T~ WithTimeoutAsync~T~(Func~CancellationToken, Task~T~~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
+Task WithTimeoutAsync(Func~CancellationToken, Task~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
+Task~T~ WithFallbackAsync~T~(Task~T~ task, Func~Exception, T~ fallback)
}
class AsyncFunctionalExtensions {
<<static>>
+Task~T~ WithRetryAsync~T~(Func~Task~T~~ taskFactory, int maxRetries, TimeSpan delay, Func~Exception, bool~ shouldRetry)
}
class NodeExtensions {
<<static>>
+void FreeX(Node node)
+Task WaitUntilReadyAsync(Node node)
+Node GetRootNodeX(Node node)
+T GetOrCreateNode~T~(Node node, string path)
+Task AddChildXAsync(Node parent, Node child)
}
class Node {
+bool IsInsideTree()
+Task ToSignal(object target, string signal)
+void AddChild(Node child)
}
NodeExtensions ..> Node : extends
AsyncFunctionalExtensions ..> AsyncExtensions : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This was referenced Mar 7, 2026
This was referenced Mar 15, 2026
This was referenced May 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
由 Sourcery 提供的总结
标准化异步扩展方法的命名,统一使用
Async后缀,并在核心代码、Godot 集成以及文档中更新所有用法。增强内容:
WithTimeout、WithRetry、WithFallback、WaitUntilReady、AddChildX)重命名为带有Async后缀的变体,以保持一致的命名规范。await调用新的带有Async后缀的就绪方法。文档:
Async后缀的方法名和示例。测试:
Async后缀的方法名,从而与新的命名约定保持一致。Original summary in English
Summary by Sourcery
Standardize async extension method naming to use the Async suffix and update usages across core, Godot integration, and docs.
Enhancements:
Documentation:
Tests: