-
Notifications
You must be signed in to change notification settings - Fork 0
API Host CompositeScriptSourceResolver
按顺序组合多个源码 Resolver;先加入者优先。
Ordered resolver composition. Earlier resolvers have higher priority.
命名空间:AuroraScript.Source。类型:class。
Namespace:
AuroraScript.Source. Kind: class.
Purpose
CompositeScriptSourceResolver 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。
Ordered resolver composition. Earlier resolvers have higher priority.
注意
ResolveAsync 按 Resolver 顺序使用原始 importer 和请求路径尝试解析;第一个非 null 结果胜出。
ResolveAsync tries resolvers in order with the original importer and requested path. The first non-null reference wins.
注意
GetSourceAsync 按精确规范化的 ScriptSourceReference.BaseDirectory 路由,而不扫描目标路径。
GetSourceAsync routes by exact normalized ScriptSourceReference.BaseDirectory, not by scanning target paths.
注意
GetAllSourcesAsync 按规范化 ScriptSource.FullPath 去重,较早来源会隐藏同标识的较晚来源。
GetAllSourcesAsync de-duplicates by normalized ScriptSource.FullPath so earlier sources hide later sources with the same identity.
注意
无需 ProviderId;Resolver 顺序和 BaseDirectory 能标识所选来源提供者。
No ProviderId is required; resolver order and BaseDirectory identify the selected provider.
Simple Example
下面是 CompositeScriptSourceResolver 的最小使用方式。
A minimal use of
CompositeScriptSourceResolver.
var resolver = ScriptSources.Composite(
ScriptSources.Memory("mem://app/")
.Add("main.as", "@module(MAIN); export func run() { return 42; }"),
ScriptSources.FileSystem("./scripts"));Members
读取 Root 属性。
Use the member according to its public signature.
Parameters:
- 无。
None.
Returns
返回 string。
Returns
string.
调用示意
以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。
The example shows the call shape; replace placeholder instances and arguments with actual host values.
CompositeScriptSourceResolver value = /* 从宿主 API 获取实例 */;
var current = value.Root;调用 Add 完成其公开操作。
Adds a resolver and caches its normalized root for later routing.
Parameters:
-
resolver
按签名提供的IScriptSourceResolver参数。The
IScriptSourceResolverparameter required by the signature.
Returns
返回 CompositeScriptSourceResolver。
Returns
CompositeScriptSourceResolver.
调用示意
以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。
The example shows the call shape; replace placeholder instances and arguments with actual host values.
CompositeScriptSourceResolver value = /* 从宿主 API 获取实例 */;
var result = value.Add(/* resolver */);AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License