InterpreterVisitor class

Main visitor that walks the AST and interprets the code. Uses a two-pass approach (DeclarationVisitor first).

Inheritance
Available extensions

Constructors

InterpreterVisitor({required Environment globalEnvironment, required ModuleContext moduleContext, Uri? initialLibrary})

Properties

currentAsyncState ↔ AsyncExecutionState?
getter/setter pair
currentFunction ↔ InterpretedFunction?
getter/setter pair
deferStaticFieldInits ↔ bool
When true, visitClassDeclaration will enqueue its static-field initializer evaluation onto _pendingStaticInitializers instead of running it immediately. The top-level runner flips this on for the multi-class declaration pass and then drains the queue.
getter/setter pair
environment ↔ Environment
getter/setter pair
globalEnvironment → Environment
final
hashCode → int
The hash code for this object.
no setterinherited
isLazySyncGeneratorContext ↔ bool
For lazy sync* generators: when true, yield throws SyncYieldSuspension to pause execution and bubble up through the call stack.
getter/setter pair
moduleContext → ModuleContext
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
syncGeneratorValues ↔ List<Object?>?
For sync* generators: the list to collect yielded values into. When non-null, yield statements add directly to this list.
getter/setter pair

Methods

computeCompoundValue(Object? currentValue, Object? rhsValue, String operatorType) → Object?
executeBlock(List<SAstNode> statements, Environment blockEnvironment) → Object?
lookupOnBridgedSupertypes(BridgedInstance<Object> bridgedInstance, String propertyName) → (Object?, bool)

Available on InterpreterVisitor, provided by the InterpreterVisitorExtension extension

Cluster-12 (priority 3): Walks the registered supertype chain of bridgedInstance's class and returns the first matching getter result or method tear-off for propertyName. Used as a fallback in property access when the leaf bridge has no matching adapter.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveStaticCoordinates(Iterable<SAstNode> declarations) → void
Run the static lexical resolver over declarations (perf plan_3 §9). The resolver writes slot coordinates directly onto the mirror SSimpleIdentifier nodes (SSimpleIdentifier.resolvedSlot) and slot carriers onto blocks/declarations, so they also survive serialization for the analyzer-free Flutter precompute target. Bundles produced via tom_ast_generator already carry these coordinates; this execute-time pass covers hand-built / deserialized units and is idempotent (it recomputes identical coordinates). S3c consumes SSimpleIdentifier.resolvedSlot directly on the read path in visitSimpleIdentifier (current-frame Environment.getSlot).
runDeferredStaticInitializers() → void
Execute and clear all pending static-field initializers. Intended to be called by the top-level runner after every class declaration has been visited, so that forward-referenced class constructors are available.
stringify(Object? value) → String
toBridgedInstance(Object? nativeObject, {String? methodName}) → (BridgedInstance<Object>?, bool)

Available on InterpreterVisitor, provided by the InterpreterVisitorExtension extension

toString() → String
A string representation of this object.
inherited
visitAdjacentStrings(SAdjacentStrings node) → Object?
Visit a SAdjacentStrings.
inherited
visitAnnotatedNode(SAnnotatedNode node) → Object?
Category fallback for all annotated nodes (declarations, directives).
inherited
visitAnnotation(SAnnotation node) → Object?
Visit a SAnnotation.
inherited
visitArgumentList(SArgumentList node) → Object?
Visit a SArgumentList.
inherited
visitAsExpression(SAsExpression node) → Object?
Visit a SAsExpression.
override
visitAssertInitializer(SAssertInitializer node) → Object?
Visit a SAssertInitializer.
inherited
visitAssertStatement(SAssertStatement node) → Object?
Visit a SAssertStatement.
override
visitAssignedVariablePattern(SAssignedVariablePattern node) → Object?
Visit a SAssignedVariablePattern.
inherited
visitAssignmentExpression(SAssignmentExpression node) → Object?
Visit a SAssignmentExpression.
override
visitAwaitExpression(SAwaitExpression node) → Object?
Visit a SAwaitExpression.
override
visitBinaryExpression(SBinaryExpression node) → Object?
Visit a SBinaryExpression.
override
visitBlock(SBlock node) → Object?
Visit a SBlock.
override
visitBlockFunctionBody(SBlockFunctionBody node) → Object?
Visit a SBlockFunctionBody.
inherited
visitBooleanLiteral(SBooleanLiteral node) → Object?
Visit a SBooleanLiteral.
override
visitBreakStatement(SBreakStatement node) → Object?
Visit a SBreakStatement.
override
visitCascadeExpression(SCascadeExpression node) → Object?
Visit a SCascadeExpression.
override
visitCaseClause(SCaseClause node) → Object?
Visit a SCaseClause.
inherited
visitCastPattern(SCastPattern node) → Object?
Visit a SCastPattern.
inherited
visitCatchClause(SCatchClause node) → Object?
Visit a SCatchClause.
inherited
visitClassDeclaration(SClassDeclaration node) → Object?
Visit a SClassDeclaration.
override
visitClassMember(SClassMember node) → Object?
Category fallback for class members (methods, fields, constructors).
inherited
visitCollectionElement(SCollectionElement node) → Object?
Category fallback for all collection elements (expressions, spread, if/for elements, map literal entries).
inherited
visitCombinator(SCombinator node) → Object?
Category fallback for all combinator nodes.
inherited
visitComment(SComment node) → Object?
Visit a SComment.
inherited
visitCompilationUnit(SCompilationUnit node) → Object?
Visit a SCompilationUnit.
override
visitCompilationUnitMember(SCompilationUnitMember node) → Object?
Category fallback for compilation unit members (top-level declarations).
inherited
visitConditionalExpression(SConditionalExpression node) → Object?
Visit a SConditionalExpression.
override
visitConfiguration(SConfiguration node) → Object?
Visit a SConfiguration.
inherited
visitConstantPattern(SConstantPattern node) → Object?
Visit a SConstantPattern.
inherited
visitConstructorDeclaration(SConstructorDeclaration node) → Object?
Visit a SConstructorDeclaration.
inherited
visitConstructorFieldInitializer(SConstructorFieldInitializer node) → Object?
Visit a SConstructorFieldInitializer.
inherited
visitConstructorInitializer(SConstructorInitializer node) → Object?
Category fallback for all constructor initializer nodes.
inherited
visitConstructorName(SConstructorName node) → Object?
Visit a SConstructorName.
inherited
visitConstructorReference(SConstructorReference node) → Object?
Visit a SConstructorReference.
override
visitContinueStatement(SContinueStatement node) → Object?
Visit a SContinueStatement.
override
visitDartPattern(SDartPattern node) → Object?
Category fallback for all Dart pattern nodes.
inherited
visitDeclaration(SDeclaration node) → Object?
Category fallback for all declaration nodes.
inherited
visitDeclaredIdentifier(SDeclaredIdentifier node) → Object?
Visit a SDeclaredIdentifier.
inherited
visitDeclaredVariablePattern(SDeclaredVariablePattern node) → Object?
Visit a SDeclaredVariablePattern.
inherited
visitDefaultFormalParameter(SDefaultFormalParameter node) → Object?
Visit a SDefaultFormalParameter.
inherited
visitDirective(SDirective node) → Object?
Category fallback for all directive nodes.
inherited
visitDoStatement(SDoStatement node) → Object?
Visit a SDoStatement.
override
visitDottedName(SDottedName node) → Object?
Visit a SDottedName.
inherited
visitDoubleLiteral(SDoubleLiteral node) → Object?
Visit a SDoubleLiteral.
override
visitEmptyFunctionBody(SEmptyFunctionBody node) → Object?
Visit a SEmptyFunctionBody.
inherited
visitEmptyStatement(SEmptyStatement node) → Object?
Visit a SEmptyStatement.
override
visitEnumConstantDeclaration(SEnumConstantDeclaration node) → Object?
Visit a SEnumConstantDeclaration.
inherited
visitEnumDeclaration(SEnumDeclaration node) → Object?
Visit a SEnumDeclaration.
override
visitExportDirective(SExportDirective node) → Object?
Visit a SExportDirective.
inherited
visitExpression(SExpression node) → Object?
Category fallback for all expression nodes.
inherited
visitExpressionFunctionBody(SExpressionFunctionBody node) → Object?
Visit a SExpressionFunctionBody.
inherited
visitExpressionStatement(SExpressionStatement node) → Object?
Visit a SExpressionStatement.
override
visitExtendsClause(SExtendsClause node) → Object?
Visit a SExtendsClause.
inherited
visitExtensionDeclaration(SExtensionDeclaration node) → Object?
Visit a SExtensionDeclaration.
override
visitExtensionTypeDeclaration(SExtensionTypeDeclaration node) → Object?
Lim-1 FIX: Handle extension type declarations (Dart 3.3+)
override
visitFieldDeclaration(SFieldDeclaration node) → Object?
Visit a SFieldDeclaration.
inherited
visitFieldFormalParameter(SFieldFormalParameter node) → Object?
Visit a SFieldFormalParameter.
inherited
visitForEachParts(SForEachParts node) → Object?
Category fallback for for-each parts.
inherited
visitForEachPartsWithDeclaration(SForEachPartsWithDeclaration node) → Object?
Visit a SForEachPartsWithDeclaration.
inherited
visitForEachPartsWithIdentifier(SForEachPartsWithIdentifier node) → Object?
Visit a SForEachPartsWithIdentifier.
inherited
visitForEachPartsWithPattern(SForEachPartsWithPattern node) → Object?
Visit a SForEachPartsWithPattern.
inherited
visitForEachStatement(SForEachStatement node) → Object?
Visit a SForEachStatement.
inherited
visitForElement(SForElement node) → Object?
Visit a SForElement.
inherited
visitForLoopParts(SForLoopParts node) → Object?
Category fallback for all for-loop parts nodes.
inherited
visitFormalParameter(SFormalParameter node) → Object?
Category fallback for all formal parameter nodes.
inherited
visitFormalParameterList(SFormalParameterList node) → Object?
Visit a SFormalParameterList.
inherited
visitForParts(SForParts node) → Object?
Category fallback for traditional for-parts.
inherited
visitForPartsWithDeclarations(SForPartsWithDeclarations node) → Object?
Visit a SForPartsWithDeclarations.
inherited
visitForPartsWithExpression(SForPartsWithExpression node) → Object?
Visit a SForPartsWithExpression.
inherited
visitForStatement(SForStatement node) → Object?
Visit a SForStatement.
override
visitFunctionBody(SFunctionBody node) → Object?
Category fallback for all function body nodes.
inherited
visitFunctionDeclaration(SFunctionDeclaration node) → Object?
Visit a SFunctionDeclaration.
override
visitFunctionDeclarationStatement(SFunctionDeclarationStatement node) → Object?
Visit a SFunctionDeclarationStatement.
override
visitFunctionExpression(SFunctionExpression node) → Object?
Visit a SFunctionExpression.
override
visitFunctionExpressionInvocation(SFunctionExpressionInvocation node) → Object?
Visit a SFunctionExpressionInvocation.
override
visitFunctionReference(SFunctionReference node) → Object?
Visit a SFunctionReference.
override
visitFunctionTypedFormalParameter(SFunctionTypedFormalParameter node) → Object?
Visit a SFunctionTypedFormalParameter.
inherited
visitGenericFunctionType(SGenericFunctionType node) → Object?
Visit a SGenericFunctionType.
inherited
visitGuardedPattern(SGuardedPattern node) → Object?
Visit a SGuardedPattern.
inherited
visitHideCombinator(SHideCombinator node) → Object?
Visit a SHideCombinator.
inherited
visitIdentifier(SAstNode node) → dynamic
Category fallback for identifier nodes.
override
visitIfElement(SIfElement node) → Object?
Visit a SIfElement.
inherited
visitIfStatement(SIfStatement node) → Object?
Visit a SIfStatement.
override
visitImplementsClause(SImplementsClause node) → Object?
Visit a SImplementsClause.
inherited
visitImportDirective(SImportDirective node) → Object?
Visit a SImportDirective.
override
visitIndexExpression(SIndexExpression node) → Object?
Visit a SIndexExpression.
override
visitInstanceCreationExpression(SInstanceCreationExpression node) → Object?
Visit a SInstanceCreationExpression.
override
visitIntegerLiteral(SIntegerLiteral node) → Object?
Visit a SIntegerLiteral.
override
visitInterpolationElement(SInterpolationElement node) → Object?
Category fallback for all interpolation element nodes.
inherited
visitInterpolationExpression(SInterpolationExpression node) → Object?
Visit a SInterpolationExpression.
inherited
visitInterpolationString(SInterpolationString node) → Object?
Visit a SInterpolationString.
inherited
visitInvocationExpression(SInvocationExpression node) → Object?
Category fallback for invocation expression nodes.
inherited
visitIsExpression(SIsExpression node) → Object?
Visit a SIsExpression.
override
visitLabel(SLabel node) → Object?
Visit a SLabel.
inherited
visitLabeledStatement(SLabeledStatement node) → Object?
Visit a SLabeledStatement.
override
visitLibraryDirective(SLibraryDirective node) → Object?
Visit a SLibraryDirective.
inherited
visitListLiteral(SListLiteral node) → Object?
Visit a SListLiteral.
override
visitListPattern(SListPattern node) → Object?
Visit a SListPattern.
inherited
visitLiteral(SLiteral node) → Object?
Category fallback for all literal nodes.
inherited
visitLogicalAndPattern(SLogicalAndPattern node) → Object?
Visit a SLogicalAndPattern.
inherited
visitLogicalOrPattern(SLogicalOrPattern node) → Object?
Visit a SLogicalOrPattern.
inherited
visitMapLiteralEntry(SMapLiteralEntry node) → Object?
Visit a SMapLiteralEntry.
inherited
visitMapPattern(SMapPattern node) → Object?
Visit a SMapPattern.
inherited
visitMapPatternEntry(SMapPatternEntry node) → Object?
Visit a SMapPatternEntry.
inherited
visitMethodDeclaration(SMethodDeclaration node) → Object?
Visit a SMethodDeclaration.
inherited
visitMethodInvocation(SMethodInvocation node) → Object?
Visit a SMethodInvocation.
override
visitMixinDeclaration(SMixinDeclaration node) → Object?
Visit a SMixinDeclaration.
override
visitNamedCompilationUnitMember(SNamedCompilationUnitMember node) → Object?
Category fallback for named compilation unit members.
inherited
visitNamedExpression(SNamedExpression node) → Object?
A named argument evaluates to its expression — the label is a name, not a value.
override
visitNamedType(SNamedType node) → Object?
Visit a SNamedType.
inherited
visitNamespaceDirective(SNamespaceDirective node) → Object?
Category fallback for namespace directives (import, export).
inherited
visitNativeFunctionBody(SNativeFunctionBody node) → Object?
Visit a SNativeFunctionBody.
inherited
visitNode(SAstNode node) → Object?
SCC33 — the dispatch backstop.
override
visitNormalFormalParameter(SNormalFormalParameter node) → Object?
Category fallback for normal (non-default) formal parameters.
inherited
visitNullAssertPattern(SNullAssertPattern node) → Object?
Visit a SNullAssertPattern.
inherited
visitNullAwareElement(SNullAwareElement node) → Object?
Visit a SNullAwareElement.
inherited
visitNullCheckPattern(SNullCheckPattern node) → Object?
Visit a SNullCheckPattern.
inherited
visitNullLiteral(SNullLiteral node) → Object?
Visit a SNullLiteral.
override
visitObjectPattern(SObjectPattern node) → Object?
Visit a SObjectPattern.
inherited
visitOnClause(SOnClause node) → Object?
Visit a SOnClause.
inherited
visitParenthesizedExpression(SParenthesizedExpression node) → Object?
Visit a SParenthesizedExpression.
override
visitParenthesizedPattern(SParenthesizedPattern node) → Object?
Visit a SParenthesizedPattern.
inherited
visitPartDirective(SPartDirective node) → Object?
Visit a SPartDirective.
inherited
visitPartOfDirective(SPartOfDirective node) → Object?
Visit a SPartOfDirective.
inherited
visitPatternAssignment(SPatternAssignment node) → Object?
Visit a SPatternAssignment.
override
visitPatternField(SPatternField node) → Object?
Visit a SPatternField.
inherited
visitPatternFieldName(SPatternFieldName node) → Object?
Visit a SPatternFieldName.
inherited
visitPatternVariableDeclaration(SPatternVariableDeclaration node) → Object?
Visit a SPatternVariableDeclaration.
inherited
visitPatternVariableDeclarationStatement(SPatternVariableDeclarationStatement node) → Object?
Visit a SPatternVariableDeclarationStatement.
override
visitPostfixExpression(SPostfixExpression node) → Object?
Visit a SPostfixExpression.
override
visitPrefixedIdentifier(SPrefixedIdentifier node) → Object?
Visit a SPrefixedIdentifier.
override
visitPrefixExpression(SPrefixExpression node) → Object?
Visit a SPrefixExpression.
override
visitPropertyAccess(SPropertyAccess node) → Object?
Visit a SPropertyAccess.
override
visitRecordLiteral(SRecordLiteral node) → Object?
Visit a SRecordLiteral.
override
visitRecordPattern(SRecordPattern node) → Object?
Visit a SRecordPattern.
inherited
visitRecordTypeAnnotation(SRecordTypeAnnotation node) → Object?
Visit a SRecordTypeAnnotation.
inherited
visitRecordTypeField(SRecordTypeField node) → Object?
Visit a SRecordTypeField.
inherited
visitRedirectingConstructorInvocation(SRedirectingConstructorInvocation node) → Object?
Visit a SRedirectingConstructorInvocation.
inherited
visitRelationalPattern(SRelationalPattern node) → Object?
Visit a SRelationalPattern.
inherited
visitRepresentationDeclaration(SRepresentationDeclaration node) → Object?
Visit a SRepresentationDeclaration.
inherited
visitRestPatternElement(SRestPatternElement node) → Object?
Visit a SRestPatternElement.
inherited
visitRethrowExpression(SRethrowExpression node) → Object?
Visit a SRethrowExpression.
override
visitReturnStatement(SReturnStatement node) → Object?
Visit a SReturnStatement.
override
visitSetOrMapLiteral(SSetOrMapLiteral node) → Object?
Visit a SSetOrMapLiteral.
override
visitShowCombinator(SShowCombinator node) → Object?
Visit a SShowCombinator.
inherited
visitSimpleFormalParameter(SSimpleFormalParameter node) → Object?
Visit a SSimpleFormalParameter.
inherited
visitSimpleIdentifier(SSimpleIdentifier node) → Object?
Visit a SSimpleIdentifier.
override
visitSimpleStringLiteral(SSimpleStringLiteral node) → Object?
Visit a SSimpleStringLiteral.
inherited
visitSingleStringLiteral(SSingleStringLiteral node) → Object?
Category fallback for single string literals (non-adjacent).
inherited
visitSpreadElement(SSpreadElement node) → Object?
Visit a SSpreadElement.
inherited
visitStatement(SStatement node) → Object?
Category fallback for all statement nodes.
inherited
visitStringInterpolation(SStringInterpolation node) → Object?
Visit a SStringInterpolation.
override
visitStringLiteral(SAstNode node) → Object?
Category fallback for string literals.
override
visitSuperConstructorInvocation(SSuperConstructorInvocation node) → Object?
Visit a SSuperConstructorInvocation.
override
visitSuperExpression(SSuperExpression node) → Object?
Visit a SSuperExpression.
override
visitSuperFormalParameter(SSuperFormalParameter node) → Object?
Visit a SSuperFormalParameter.
inherited
visitSwitchCase(SSwitchCase node) → Object?
Visit a SSwitchCase.
inherited
visitSwitchDefault(SSwitchDefault node) → Object?
Visit a SSwitchDefault.
inherited
visitSwitchExpression(SSwitchExpression node) → Object?
Visit a SSwitchExpression.
override
visitSwitchExpressionCase(SSwitchExpressionCase node) → Object?
Visit a SSwitchExpressionCase.
inherited
visitSwitchMember(SSwitchMember node) → Object?
Category fallback for all switch member nodes (case/default).
inherited
visitSwitchPatternCase(SSwitchPatternCase node) → Object?
Visit a SSwitchPatternCase.
inherited
visitSwitchStatement(SSwitchStatement node) → Object?
Visit a SSwitchStatement.
override
visitSymbolLiteral(SSymbolLiteral node) → Object?
Visit a SSymbolLiteral.
override
visitThisExpression(SThisExpression node) → Object?
Visit a SThisExpression.
override
visitThrowExpression(SThrowExpression node) → Object?
Visit a SThrowExpression.
override
visitTopLevelVariableDeclaration(STopLevelVariableDeclaration node) → Object?
Visit a STopLevelVariableDeclaration.
override
visitTryStatement(STryStatement node) → Object?
Visit a STryStatement.
override
visitTypeAnnotation(STypeAnnotation node) → Object?
Category fallback for all type annotation nodes.
inherited
visitTypeArgumentList(STypeArgumentList node) → Object?
Visit a STypeArgumentList.
inherited
visitTypedefDeclaration(STypedefDeclaration node) → Object?
A typedef has no runtime representation, so it evaluates to nothing.
override
visitTypedLiteral(STypedLiteral node) → Object?
Category fallback for typed literals (list, set/map).
inherited
visitTypeParameter(STypeParameter node) → Object?
Visit a STypeParameter.
inherited
visitTypeParameterList(STypeParameterList node) → Object?
Visit a STypeParameterList.
inherited
visitUriBasedDirective(SUriBasedDirective node) → Object?
Category fallback for URI-based directives (import, export, part).
inherited
visitVariableDeclaration(SVariableDeclaration node) → Object?
Visit a SVariableDeclaration.
inherited
visitVariableDeclarationList(SVariableDeclarationList node) → Object?
Visit a SVariableDeclarationList.
override
visitVariableDeclarationStatement(SVariableDeclarationStatement node) → Object?
Visit a SVariableDeclarationStatement.
override
visitVariablePattern(SVariablePattern node) → Object?
Category fallback for variable patterns.
inherited
visitWhenClause(SWhenClause node) → Object?
Visit a SWhenClause.
inherited
visitWhileStatement(SWhileStatement node) → Object?
Visit a SWhileStatement.
override
visitWildcardPattern(SWildcardPattern node) → Object?
Visit a SWildcardPattern.
inherited
visitWithClause(SWithClause node) → Object?
Visit a SWithClause.
inherited
visitYieldStatement(SYieldStatement node) → Object?
Visit a SYieldStatement.
override
wrapNativeReturnValue(Object? nativeValue) → Object?
Wraps a native return value from a bridged call in a BridgedInstance if a bridge exists, otherwise returns the value as-is.

Operators

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