ApolloVM class

The Apollo VM.

Implemented types
Available extensions

Constructors

ApolloVM({bool nullSafetyChecks = false})

Properties

hashCode int
The hash code for this object.
no setterinherited
id int
final
loadedCodeLanguages List<String>
no setter
moduleLoader ModuleLoader?
An optional custom ModuleLoader for import resolution. When set (before the resolutionEngine is first used), it replaces the default web-safe in-memory VMModuleLoader — e.g. a DartPackageLoader that resolves package: imports. Leave null for the default in-memory behavior.
getter/setter pair
nullSafetyChecks bool
Whether loadCodeUnit rejects a code unit whose AST has null-safety errors, throwing NullSafetyError before the unit is registered.
final
resolutionEngine ModuleResolutionEngine
The lazily-created module-resolution engine, backed by moduleLoader when set, otherwise the web-safe in-memory VMModuleLoader.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

allCodeUnits(String language) List<CodeUnit>
All loaded CodeUnits of language across every namespace.
allCodeUnitsAllLanguages() List<CodeUnit>
All loaded CodeUnits across every language and namespace.
createCodeGenerator(String language, ApolloSourceCodeStorage codeStorage) → ApolloCodeGenerator?
Creates an ApolloCodeGenerator for the language and a codeStorage.
createGenerator<O extends Object>(String language, ApolloCodeUnitStorage<O> codeStorage) ApolloGenerator<Object, ApolloCodeUnitStorage<Object>, Object>?
Creates an ApolloGenerator for the language and a codeStorage.
createRunner(String language, {bool importCorePackageMath = false}) ApolloRunner?
Creates a runner for the language.
generateAll(ApolloGenerator<Object, ApolloCodeUnitStorage<Object>, Object> generator) → void
Generate all the loaded code with codeGenerator implementation.
generateAllCode(ApolloCodeGenerator codeGenerator) → void
Generate all the loaded code with codeGenerator implementation.
generateAllCodeIn(String language, {ApolloSourceCodeStorage? codeStorage}) → ApolloSourceCodeStorage
Generates all the VM loaded code in language, returning a ApolloSourceCodeStorage.
generateAllIn<O extends Object>(String language, {ApolloCodeUnitStorage<O>? codeStorage}) → ApolloCodeUnitStorage<O>
Generates all the VM loaded code in language, returning a ApolloSourceCodeStorage.
getLanguageNamespaces(String language) LanguageNamespaces
Returns a LanguageNamespaces for language.
getNamespace(String language, String namespace) CodeNamespace?
Returns a CodeNamespace for language and namespace.
getNamespaceWithClass(String className, {String? language, bool caseInsensitive = false}) List<CodeNamespace>
Returns a CodeNamespace with class className for language (optional).
getNamespaceWithName(String namespace) List<CodeNamespace>
Returns a List of CodeNamespace with name namespace.
getNamespaceWithNameAndClass(String namespace, String className, {bool caseInsensitive = false}) List<CodeNamespace>
Returns a List of CodeNamespace with name namespace and with class className.
getParser<T extends Object>(String language) ApolloCodeParser<T>?
Returns a parser for a language.
loadAllAST(Uint8List archive, {ASTBinaryVerifier? verifier, ASTBinaryVerifier? entryVerifier}) Future<int>

Available on ApolloVM, provided by the ApolloVMBinaryAST extension

Loads every code unit in an archive, returning how many were loaded.
loadCodeUnit<T extends Object>(CodeUnit<T> codeUnit) Future<bool>
Loads codeUnit, parsing the CodeUnit.source to the corresponding AST (Abstract Syntax Tree).
loadCodeUnitAST(Uint8List image, {ASTBinaryVerifier? verifier, String? id, String? namespace}) Future<bool>

Available on ApolloVM, provided by the ApolloVMBinaryAST extension

Decodes a binary AST image and loads it, skipping the parser entirely.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve({String? language}) List<ImportDiagnostic>
Resolves the import graph of all loaded modules (optionally restricted to language) and returns the aggregated ImportDiagnostics. Idempotent and incremental: already-resolved modules are served from cache, and (re)loading a CodeUnit invalidates the affected subgraph.
resolveCoreType(String typeName, {String? namespace, String? language, bool caseInsensitive = false}) ASTType?
resolveType(String typeName, {String? namespace, String? language, bool caseInsensitive = false}) ASTType?
Resolves an ASTType with typeName.
override
saveAllAST({String? language, ASTBinarySigner? signer}) Uint8List

Available on ApolloVM, provided by the ApolloVMBinaryAST extension

Bundles the AST of every loaded code unit into a single archive.
saveCodeUnitAST(CodeUnit codeUnit, {ASTBinarySigner? signer}) Uint8List

Available on ApolloVM, provided by the ApolloVMBinaryAST extension

Encodes the AST of codeUnit, which must already be loaded.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

VERSION String
final

Static Methods

parseLanguageFromFilePathExtension(String fileOrExtension) String
Returns the language associated with fileOrExtension.