dscript_dart library
Classes
- $Type
- Represents a type in the Dscript language.
- AnalyzerErrorListener
- Error listener for the ANTLR parser that reports syntax errors to the given analysis report.
-
BindingBuilder<
T> - A builder for defining an external runtime binding.
- BytecodeFunction
- A function compiled to bytecode.
- CompiledScript
- Result of compiling a script.
- Compiler
- Base class for compiling Dscript code into bytecode.
- ContractSignature
- Signature of a contract.
- ContractSignatureBuilder
- A builder for creating a ContractSignature.
- DefaultVM
- The default implementation of VM.
- DynamicType
- Dynamic Type meaning the type is not known at compile time.
- ExternalBindings
- A library binding that contains external bindings defined by the host at runtime.
- FunctionSignature
- Signature of a function.
- HookBuilder
- A builder for a hook signature within a contract.
- HookSignature
- Signature of a hook.
- ImplBuilder
- A builder for an implementation signature within a contract.
- ImplementationSignature
- Signature of an implementation.
- Instruction
- Represents a single instruction in the bytecode.
- InvalidType
- Invalid Type meaning the type is not defined or not recognized.
- IsolateRuntime
- Same as Runtime but each invocation of run or emit will be executed in a separate isolate.
- ListType
- Represents a List type (e.g., List
- MapType
- Represents a Map type (e.g., Map<String, int>).
- NaiveCompiler
- Default compiler for Dscript scripts.
- ParameterSignature
- Signature of a function parameter.
- PrimitiveType
- Represents a primitive type (e.g., int, string, etc.). This class is used to represent basic data types in the Dscript language.
- Runtime
- The Dscript runtime environment.
-
RuntimeBinding<
T> - A binding that connects a Dart function to the dscript runtime.
- Script
- Metadata of an analyzed script.
- ScriptMetadata
- Metadata of an analyzed script.
- ScriptPermission
- Represents a permission required or granted to execute script operations.
- Signature
- Base class for all signatures.
- Span
- Represents a span of text in the source code, defined by its start and end lines and columns.
- Struct
- Represents a custom object type.
- StructBuilder
- A builder for defining a Struct type used by a contract.
- TypeScope
-
Same as
Scopebut only stores the types of variables and not their values. - VM
- A virtual machine executing a BytecodeFunction.
Extensions
- BufferDebugX on Uint64List
- Provides debugging utilities for a bytecode buffer.
- BytecodeFunctionDebugX on BytecodeFunction
- Provides debugging utilities for a BytecodeFunction.
-
HookX
on List<
HookSignature> - Extension methods for List<HookSignature>.
-
ImplementationX
on List<
ImplementationSignature> - Extension methods for List<ImplementationSignature>.
Functions
-
analyze(
CharStream code, List< ContractSignature> contracts, {bool ignoreWarnings = false}) → ResultDart<Script, AnalysisReport> -
Analyzes the script in the given
codeagainst the providedcontracts. -
bind<
T> (String name, Function function) → BindingBuilder< T> - Shorthand to start a standalone BindingBuilder.
-
compile(
Script script, [Compiler compiler(List< VarDeclContext> globals) = NaiveCompiler.new]) → CompiledScript -
Compiles an analyzed
scriptinto a CompiledScript. -
contract(
String name) → ContractSignatureBuilder -
Shorthand to start a ContractSignatureBuilder for
name. -
hook(
String name) → HookBuilder - Shorthand to start a standalone HookBuilder.
-
impl(
String name, {required $Type returnType}) → ImplBuilder - Shorthand to start a standalone ImplBuilder.
-
struct(
String name) → StructBuilder - Shorthand to start a standalone StructBuilder.
Typedefs
- FrameIndex = ({int frame, int index})
- Represents a frame index in the stack. It is a tuple of two integers: the frame index and the variable index within that frame. This is used to track the position of variables in the stack frames during compilation.
Exceptions / Errors
- AnalysisReport
- A report of analysis errors.
- AnalyzerMessage
-
A message reported by the
Analyzer. - ArgumentTypeMismatchError
- An error thrown when an argument's type does not match the expected type.
- AssignmentError
- An error thrown when a type mismatch occurs during assignment.
- ContractDeclarationError
- An error thrown when a contract declaration is invalid. This may be due to:
- HookDeclarationError
- An error thrown when a hook declaration is invalid. This may be due to the hook not being defined in the contract or having an incorrect number of parameters.
- ImplentationDeclarationError
- An error thrown when a hook declaration is invalid. This may be due to:
- InferenceError
- An error thrown when a statement's runtime type cannot be inferred.
- NullSafetyError
- An error thrown when a value is accessed without null safety checks, but the value is potentially null.
- OperationError
- An error thrown when an operation is not supported for a given type.
- PermissionError
- An error thrown when an external function is called without the required permission.
- PositionalArgumentError
- Thrown when too many or too little positional arguments are passed to a function.
- RedefinitionError
- An error thrown when a function or variable are already defined in the current scope.
- RequiredMetadataError
- An error thrown when required metadata is not defined in the script.
- ReturnError
- An error thrown when an invalid type is returned from a function.
- SemanticError
- An error thrown when a semantic error occurs during analysis. This is a subclass of AnalyzerMessage with a severity of 1.
- SemanticWarning
- A warning thrown when a semantic issue is detected during analysis.
- SyntaxError
- An error thrown when a syntax error is encountered during parsing.
- TypeError
- An error thrown when a type mismatch occurs during analysis.
- UndefinedArgumentError
- Thrown when a named argument is passed that is not defined in the function signature.
- UndefinedError
- Error thrown when a symbol referenced is not defined in the current scope.
- UndefinedExternalFunctionError
- Thrown when a called function is not defined in the given namespace .
- UndefinedNamespaceError
- An error thrown when a referenced namespace is not defined.
- UndefinedVariableError
- An error thrown when a variable is not defined in the current scope.
- UnnecessaryNullCheckWarning
- An unnecessary null check warning.