-
Notifications
You must be signed in to change notification settings - Fork 0
API Host MemorySource
由内存字符串承载的脚本源码。
Script source backed by an in-memory string.
命名空间:AuroraScript.Source。类型:class。
Namespace:
AuroraScript.Source. Kind: class.
Purpose
MemorySource 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。
Script source backed by an in-memory string.
Simple Example
下面是 MemorySource 的最小使用方式。
A minimal use of
MemorySource.
var source = new MemorySource(
"mem://app/",
"main.as",
"@module(MAIN); export func run() { return 42; }");
Console.WriteLine(source.SourcePath); // main.asMembers
创建 MemorySource 实例。
Use the member according to its public signature.
Parameters:
-
baseDirectory
来源所属的 Resolver 根目录。Resolver root directory owning the source.
-
fullPath
来源的规范化完整路径。Normalized full path of the source.
-
text
要保存或读取的文本。Text to store or read.
Returns
新建的 MemorySource 实例。
A new
MemorySourceinstance.
调用示意
以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。
The example shows the call shape; replace placeholder instances and arguments with actual host values.
var value = new MemorySource(/* 参数 */);读取 BaseDirectory 属性。
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.
MemorySource value = /* 从宿主 API 获取实例 */;
var current = value.BaseDirectory;读取 SourcePath 属性。
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.
MemorySource value = /* 从宿主 API 获取实例 */;
var current = value.SourcePath;读取 FullPath 属性。
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.
MemorySource value = /* 从宿主 API 获取实例 */;
var current = value.FullPath;读取 Code 属性。
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.
MemorySource value = /* 从宿主 API 获取实例 */;
var current = value.Code;调用 ReadSource 完成其公开操作。
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.
MemorySource value = /* 从宿主 API 获取实例 */;
var result = value.ReadSource();AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License