Unified Runtime compiler facade for metadata, diagnostics, and module preparation. 更多...
#include <ScriptCompiler.h>
Public 成员函数 | |
| ScriptCompiler (ssq::VM &vm, ScriptModuleResolver &modules) | |
| Script compiler. | |
| ~ScriptCompiler () | |
| Script compiler. | |
| ssq::Script | compileSource (std::string_view source, std::string_view sourceName) |
| Compiles UTF-8 source and records metadata under sourceName. | |
| ssq::Script | compileFile (std::string_view path) |
| Compiles a file through the VM and records its canonical identity. | |
| eve::OptionalRef< const ScriptMetadata > | metadata (std::string_view canonicalUri) const noexcept |
| Borrows metadata for the most recent successful compilation. | |
| std::vector< ScriptMetadata > | metadataSnapshot () const |
| Returns all successful compilation metadata sorted by URI. | |
| BindingContractRegistry & | bindings () noexcept |
| Native binding contracts used by semantic checks and tools. | |
| const BindingContractRegistry & | bindings () const noexcept |
| Const native binding contract registry. | |
| void | registerAnnotation (std::string name) |
| Registers one plugin annotation name accepted by the parser. | |
| bool | unregisterAnnotation (std::string_view name) |
| Removes one plugin annotation name. | |
| std::vector< ScriptCompletion > | completions (std::string_view canonicalUri, std::string_view prefix={}) const |
| Returns completion candidates from script metadata and native contracts. | |
| std::optional< ScriptHover > | hover (std::string_view canonicalUri, std::string_view symbol) const |
| Returns hover information for a script or native symbol. | |
| std::vector< ScriptDiagnostic > | diagnostics (std::string_view canonicalUri) const |
| Returns the latest diagnostics for one source unit. | |
| bool | setSourceMap (std::string_view canonicalUri, ScriptSourceMap sourceMap) |
| Replaces the source map retained for a compiled unit. | |
静态 Public 成员函数 | |
| static ScriptSourcePosition | toOriginalPosition (std::string_view source, ScriptSourcePosition generated) |
| Maps a VM/generated location through any active compiler metadata. | |
| static ScriptSourcePosition | toGeneratedPosition (std::string_view source, ScriptSourcePosition original) |
| Maps an IDE/original location to the VM location used for breakpoints. | |
| static SQRESULT | compileBuffer (HSQUIRRELVM vm, const SQChar *source, SQInteger size, const SQChar *sourceName, SQBool raiseError) |
| Unified raw-VM entry used by REPL, debugger, MCP, and editor adapters. | |
| static std::vector< ScriptDiagnostic > | validateProjectConfig (std::string_view source, std::string_view canonicalUri, const std::vector< std::string > &knownModules, const std::vector< std::string > &activeModules) |
| Statically checks literal config module lists without executing config.nut. | |
| static ScriptMetadata | analyze (std::string_view source, std::string_view canonicalUri) |
| Performs source-only metadata extraction without executing code. | |
详细描述
Unified Runtime compiler facade for metadata, diagnostics, and module preparation.
在文件 ScriptCompiler.h 第 213 行定义.
构造及析构函数说明
◆ ScriptCompiler()
| eve::script::ScriptCompiler::ScriptCompiler | ( | ssq::VM & | vm, |
| ScriptModuleResolver & | modules | ||
| ) |
Script compiler.
在文件 ScriptCompiler.cpp 第 456 行定义.
引用了 choices, eve::script::generatedBindingContracts(), index, name, top, type, unit , 以及 units.
◆ ~ScriptCompiler()
| eve::script::ScriptCompiler::~ScriptCompiler | ( | ) |
Script compiler.
在文件 ScriptCompiler.cpp 第 508 行定义.
成员函数说明
◆ analyze()
|
static |
Performs source-only metadata extraction without executing code.
在文件 ScriptCompiler.cpp 第 767 行定义.
引用了 eve::script::ScriptMetadata::asyncFunctions, eve::script::ScriptPropertyMetadata::attributes, eve::script::ScriptMetadata::awaitLocations, eve::script::ScriptSourceMap::canonicalUri, eve::script::ScriptMetadata::canonicalUri, eve::script::ScriptPropertyMetadata::choices, eve::script::ScriptSourceMap::entries, eve::script::ScriptPropertyMetadata::erasedType, eve::script::ScriptMetadata::exports, eve::script::ScriptMetadata::imports, eve::script::ScriptMetadata::moduleReferences, eve::script::ScriptPropertyMetadata::name, name, offset, options, eve::script::ScriptMetadata::persistRoots, eve::script::ScriptMetadata::properties, eve::script::ScriptMetadata::providerOrigin, source, eve::script::ScriptMetadata::sourceHash, eve::script::ScriptMetadata::sourceMap , 以及 eve::script::ScriptMetadata::symbols.
◆ bindings() [1/2]
|
noexcept |
Const native binding contract registry.
在文件 ScriptCompiler.cpp 第 599 行定义.
◆ bindings() [2/2]
|
noexcept |
Native binding contracts used by semantic checks and tools.
在文件 ScriptCompiler.cpp 第 598 行定义.
被这些函数引用 eve::dev::LanguageServer::Impl::complete() , 以及 eve::dev::LanguageServer::Impl::signatureHelp().
◆ compileBuffer()
|
static |
Unified raw-VM entry used by REPL, debugger, MCP, and editor adapters.
在文件 ScriptCompiler.cpp 第 694 行定义.
引用了 eve::script::ScriptDiagnostic::canonicalUri, eve::script::captureCompileError(), eve::script::ScriptDiagnostic::code, eve::script::ScriptSourcePosition::column, compiler, context, error, found, eve::script::ScriptSourcePosition::line, eve::script::ScriptDiagnostic::message, eve::script::ScriptDiagnostic::position, size, source, text, top, uri , 以及 vm.
被这些函数引用 eve::dev::ConsolePanel::eval().
◆ compileFile()
| ssq::Script eve::script::ScriptCompiler::compileFile | ( | std::string_view | path | ) |
◆ compileSource()
| ssq::Script eve::script::ScriptCompiler::compileSource | ( | std::string_view | source, |
| std::string_view | sourceName | ||
| ) |
Compiles UTF-8 source and records metadata under sourceName.
在文件 ScriptCompiler.cpp 第 517 行定义.
◆ completions()
| std::vector< ScriptCompletion > eve::script::ScriptCompiler::completions | ( | std::string_view | canonicalUri, |
| std::string_view | prefix = {} |
||
| ) | const |
Returns completion candidates from script metadata and native contracts.
在文件 ScriptCompiler.cpp 第 607 行定义.
◆ diagnostics()
| std::vector< ScriptDiagnostic > eve::script::ScriptCompiler::diagnostics | ( | std::string_view | canonicalUri | ) | const |
◆ hover()
| std::optional< ScriptHover > eve::script::ScriptCompiler::hover | ( | std::string_view | canonicalUri, |
| std::string_view | symbol | ||
| ) | const |
Returns hover information for a script or native symbol.
在文件 ScriptCompiler.cpp 第 647 行定义.
引用了 eve::script::ScriptHover::position , 以及 unit.
◆ metadata()
|
noexcept |
Borrows metadata for the most recent successful compilation.
- 返回
- Empty when no compiled unit exists for the URI.
- 注解
- The compiler owns the metadata. The reference is invalidated by the next compile or source-map update and by destruction of this compiler. It must not be retained across those operations or across threads.
在文件 ScriptCompiler.cpp 第 571 行定义.
引用了 found.
◆ metadataSnapshot()
| std::vector< ScriptMetadata > eve::script::ScriptCompiler::metadataSnapshot | ( | ) | const |
Returns all successful compilation metadata sorted by URI.
在文件 ScriptCompiler.cpp 第 577 行定义.
◆ registerAnnotation()
| void eve::script::ScriptCompiler::registerAnnotation | ( | std::string | name | ) |
Registers one plugin annotation name accepted by the parser.
在文件 ScriptCompiler.cpp 第 601 行定义.
引用了 name.
◆ setSourceMap()
| bool eve::script::ScriptCompiler::setSourceMap | ( | std::string_view | canonicalUri, |
| ScriptSourceMap | sourceMap | ||
| ) |
Replaces the source map retained for a compiled unit.
在文件 ScriptCompiler.cpp 第 674 行定义.
◆ toGeneratedPosition()
|
static |
Maps an IDE/original location to the VM location used for breakpoints.
在文件 ScriptCompiler.cpp 第 688 行定义.
引用了 eve::script::ScriptSourceMap::generatedPosition(), position , 以及 source.
◆ toOriginalPosition()
|
static |
Maps a VM/generated location through any active compiler metadata.
在文件 ScriptCompiler.cpp 第 682 行定义.
引用了 eve::script::ScriptSourceMap::originalPosition(), position , 以及 source.
◆ unregisterAnnotation()
| bool eve::script::ScriptCompiler::unregisterAnnotation | ( | std::string_view | name | ) |
◆ validateProjectConfig()
|
static |
Statically checks literal config module lists without executing config.nut.
在文件 ScriptCompiler.cpp 第 736 行定义.
引用了 active, eve::script::ScriptDiagnostic::canonicalUri, eve::script::ScriptDiagnostic::code, eve::script::ScriptDiagnostic::fix, eve::script::ScriptDiagnostic::message, name, eve::script::ScriptDiagnostic::position, eve::script::ScriptDiagnostic::related, required, source, value , 以及 values.
该类的文档由以下文件生成:
- src/engine/common/ScriptCompiler.h
- src/engine/common/ScriptCompiler.cpp