-
Notifications
You must be signed in to change notification settings - Fork 0
API Host ScriptSource
ScriptSource and References
Overview
ScriptSource 表示源码文本及其路径身份;MemorySource 是字符串后备实现;ScriptSourceReference 是 Resolver 解析后可稳定路由的身份。它们通常由 Resolver 创建,应用代码通常使用 ScriptSources。
ScriptSourcerepresents source text and path identity;MemorySourceis a string-backed implementation;ScriptSourceReferenceis the stable identity produced by resolution. Resolvers usually create these types, while application code usually usesScriptSources.
Returns
分别为 Resolver 根、模块相对路径、完整或虚拟路径、源码文本。
Resolver root, module-relative path, full or virtual path, and source text.
ScriptSource source = new MemorySource("mem://app/", "mem://app/main.as", "@module(MAIN);");
Console.WriteLine(source.FullPath);
Console.WriteLine(source.Code);Parameters:
- 无。
None.
Returns
源码文本。
Source text.
var source = new MemorySource("mem://app/", "mem://app/main.as", "@module(MAIN);");
var text = source.ReadSource();Parameters:
-
baseDirectory
Resolver 根。Resolver root.
-
fullPath
虚拟完整路径。Virtual full path.
-
text
源码。Source text.
Returns
内存源码。
In-memory source.
var source = new MemorySource("mem://app/", "mem://app/main.as", "@module(MAIN);");Parameters:
-
baseDirectory
应读取此引用的 Resolver 根。Resolver root that reads this reference.
-
fullPath
规范化完整路径。Normalized full path.
-
modulePath
可选模块相对路径。Optional module-relative path.
Returns
值类型引用。
Value-type reference.
var reference = new ScriptSourceReference("mem://app/", "mem://app/main.as", "main.as");
Console.WriteLine(reference.ModulePath);AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License