载入中...
搜索中...
未找到
eve::script::ScriptCompiler类 参考

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()

◆ bindings() [1/2]

const BindingContractRegistry & eve::script::ScriptCompiler::bindings ( ) const
noexcept

Const native binding contract registry.

在文件 ScriptCompiler.cpp 第 599 行定义.

◆ bindings() [2/2]

BindingContractRegistry & eve::script::ScriptCompiler::bindings ( )
noexcept

Native binding contracts used by semantic checks and tools.

在文件 ScriptCompiler.cpp 第 598 行定义.

被这些函数引用 eve::dev::LanguageServer::Impl::complete() , 以及 eve::dev::LanguageServer::Impl::signatureHelp().

◆ compileBuffer()

SQRESULT eve::script::ScriptCompiler::compileBuffer ( HSQUIRRELVM  vm,
const SQChar *  source,
SQInteger  size,
const SQChar *  sourceName,
SQBool  raiseError 
)
static

◆ compileFile()

ssq::Script eve::script::ScriptCompiler::compileFile ( std::string_view  path)

Compiles a file through the VM and records its canonical identity.

在文件 ScriptCompiler.cpp 第 540 行定义.

引用了 error, input, path, source , 以及 uri.

◆ 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 行定义.

引用了 error, source , 以及 uri.

◆ 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 行定义.

引用了 name, unit , 以及 value.

被这些函数引用 eve::dev::LanguageServer::Impl::complete().

◆ diagnostics()

std::vector< ScriptDiagnostic > eve::script::ScriptCompiler::diagnostics ( std::string_view  canonicalUri) const

Returns the latest diagnostics for one source unit.

在文件 ScriptCompiler.cpp 第 669 行定义.

引用了 unit.

被这些函数引用 eve::dev::LanguageServer::Impl::diagnostics().

◆ 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.

被这些函数引用 eve::dev::LanguageServer::Impl::hover().

◆ metadata()

eve::OptionalRef< const ScriptMetadata > eve::script::ScriptCompiler::metadata ( std::string_view  canonicalUri) const
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.

被这些函数引用 eve::dev::LanguageServer::Impl::complete().

◆ metadataSnapshot()

std::vector< ScriptMetadata > eve::script::ScriptCompiler::metadataSnapshot ( ) const

Returns all successful compilation metadata sorted by URI.

在文件 ScriptCompiler.cpp 第 577 行定义.

引用了 a , 以及 b.

◆ 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 行定义.

引用了 eve::script::ScriptSourceMap::canonicalUri , 以及 found.

◆ toGeneratedPosition()

ScriptSourcePosition eve::script::ScriptCompiler::toGeneratedPosition ( std::string_view  source,
ScriptSourcePosition  original 
)
static

Maps an IDE/original location to the VM location used for breakpoints.

在文件 ScriptCompiler.cpp 第 688 行定义.

引用了 eve::script::ScriptSourceMap::generatedPosition(), position , 以及 source.

◆ toOriginalPosition()

ScriptSourcePosition eve::script::ScriptCompiler::toOriginalPosition ( std::string_view  source,
ScriptSourcePosition  generated 
)
static

Maps a VM/generated location through any active compiler metadata.

在文件 ScriptCompiler.cpp 第 682 行定义.

引用了 eve::script::ScriptSourceMap::originalPosition(), position , 以及 source.

被这些函数引用 eve::dev::DebugAdapter::notifyStopped().

◆ unregisterAnnotation()

bool eve::script::ScriptCompiler::unregisterAnnotation ( std::string_view  name)

Removes one plugin annotation name.

在文件 ScriptCompiler.cpp 第 605 行定义.

引用了 name.

◆ validateProjectConfig()

std::vector< ScriptDiagnostic > eve::script::ScriptCompiler::validateProjectConfig ( std::string_view  source,
std::string_view  canonicalUri,
const std::vector< std::string > &  knownModules,
const std::vector< std::string > &  activeModules 
)
static

该类的文档由以下文件生成: