StaticResolver class

Static lexical resolver (plan_3 §4.4 / §9 S1–S2), operating directly on the serializable mirror AST.

Walks the AST maintaining a stack of _ScopeFrames that mirror the interpreter's Environment nesting (via opensLexicalFrame). For every identifier use whose declaration it can prove lives in the innermost modelled scope (depth 0), it writes the coordinate onto the node (SSimpleIdentifier.resolvedDepth / SSimpleIdentifier.resolvedSlot) so it serializes into the bundle (analyzer-free Flutter precompute target). All other uses (cross-frame, parameters, top-level/global, bridge/prefixed/enum names, anything ambiguous) are left unresolved and continue on the existing name-keyed Environment.get path.

S1/S2 deliberately emit only depth-0 coordinates: an innermost-block local is, by construction, at live depth 0 from any use in that same block, so the runtime depth assert can never fire on a sound emission. Widening to cross-frame depths is a later increment (S3) under the same harness.

The mirror AST has no .parent back-pointer, so an analyzer-style parent-based use-filter is not possible here. That filtering is a pure optimisation (it avoids annotating inert nodes), not a correctness requirement: emission is conditioned on the name matching an innermost-block local, and any such match is at live depth 0 regardless of the node's syntactic role — so the depth assert holds. The single cheap filter kept is SSimpleIdentifier.inDeclarationContext, which excludes declaration sites.

Inheritance

Constructors

StaticResolver()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(Iterable<SAstNode> declarations) → void
Resolve every identifier use under declarations, writing coordinates onto the nodes. Idempotent: re-running recomputes the same coordinates.
toString() String
A string representation of this object.
inherited
visitAdjacentStrings(SAdjacentStrings node) → void
Visit a SAdjacentStrings.
inherited
visitAnnotatedNode(SAnnotatedNode node) → void
Category fallback for all annotated nodes (declarations, directives).
inherited
visitAnnotation(SAnnotation node) → void
Visit a SAnnotation.
inherited
visitArgumentList(SArgumentList node) → void
Visit a SArgumentList.
inherited
visitAsExpression(SAsExpression node) → void
Visit a SAsExpression.
inherited
visitAssertInitializer(SAssertInitializer node) → void
Visit a SAssertInitializer.
inherited
visitAssertStatement(SAssertStatement node) → void
Visit a SAssertStatement.
inherited
visitAssignedVariablePattern(SAssignedVariablePattern node) → void
Visit a SAssignedVariablePattern.
inherited
visitAssignmentExpression(SAssignmentExpression node) → void
Visit a SAssignmentExpression.
override
visitAwaitExpression(SAwaitExpression node) → void
Visit a SAwaitExpression.
inherited
visitBinaryExpression(SBinaryExpression node) → void
Visit a SBinaryExpression.
inherited
visitBlock(SBlock node) → void
Resolve a block frame, then commit compacted slots (perf plan_3 §4.6): eligible candidate decls get dense indices 0..k-1 in lexical order, their pending depth-0 reads get resolvedSlot, and the block records slotCount.
override
visitBlockFunctionBody(SBlockFunctionBody node) → void
Visit a SBlockFunctionBody.
inherited
visitBooleanLiteral(SBooleanLiteral node) → void
Visit a SBooleanLiteral.
inherited
visitBreakStatement(SBreakStatement node) → void
Visit a SBreakStatement.
inherited
visitCascadeExpression(SCascadeExpression node) → void
Visit a SCascadeExpression.
inherited
visitCaseClause(SCaseClause node) → void
Visit a SCaseClause.
inherited
visitCastPattern(SCastPattern node) → void
Visit a SCastPattern.
inherited
visitCatchClause(SCatchClause node) → void
Visit a SCatchClause.
override
visitClassDeclaration(SClassDeclaration node) → void
Visit a SClassDeclaration.
inherited
visitClassMember(SClassMember node) → void
Category fallback for class members (methods, fields, constructors).
inherited
visitCollectionElement(SCollectionElement node) → void
Category fallback for all collection elements (expressions, spread, if/for elements, map literal entries).
inherited
visitCombinator(SCombinator node) → void
Category fallback for all combinator nodes.
inherited
visitComment(SComment node) → void
Visit a SComment.
inherited
visitCompilationUnit(SCompilationUnit node) → void
Visit a SCompilationUnit.
inherited
visitCompilationUnitMember(SCompilationUnitMember node) → void
Category fallback for compilation unit members (top-level declarations).
inherited
visitConditionalExpression(SConditionalExpression node) → void
Visit a SConditionalExpression.
inherited
visitConstantPattern(SConstantPattern node) → void
Visit a SConstantPattern.
inherited
visitConstructorDeclaration(SConstructorDeclaration node) → void
Visit a SConstructorDeclaration.
override
visitConstructorFieldInitializer(SConstructorFieldInitializer node) → void
Visit a SConstructorFieldInitializer.
inherited
visitConstructorInitializer(SConstructorInitializer node) → void
Category fallback for all constructor initializer nodes.
inherited
visitConstructorName(SConstructorName node) → void
Visit a SConstructorName.
inherited
visitConstructorReference(SConstructorReference node) → void
Visit a SConstructorReference.
inherited
visitContinueStatement(SContinueStatement node) → void
Visit a SContinueStatement.
inherited
visitDartPattern(SDartPattern node) → void
Category fallback for all Dart pattern nodes.
inherited
visitDeclaration(SDeclaration node) → void
Category fallback for all declaration nodes.
inherited
visitDeclaredIdentifier(SDeclaredIdentifier node) → void
Visit a SDeclaredIdentifier.
inherited
visitDeclaredVariablePattern(SDeclaredVariablePattern node) → void
Visit a SDeclaredVariablePattern.
inherited
visitDefaultFormalParameter(SDefaultFormalParameter node) → void
Visit a SDefaultFormalParameter.
inherited
visitDirective(SDirective node) → void
Category fallback for all directive nodes.
inherited
visitDoStatement(SDoStatement node) → void
Visit a SDoStatement.
override
visitDoubleLiteral(SDoubleLiteral node) → void
Visit a SDoubleLiteral.
inherited
visitEmptyFunctionBody(SEmptyFunctionBody node) → void
Visit a SEmptyFunctionBody.
inherited
visitEmptyStatement(SEmptyStatement node) → void
Visit a SEmptyStatement.
inherited
visitEnumConstantDeclaration(SEnumConstantDeclaration node) → void
Visit a SEnumConstantDeclaration.
inherited
visitEnumDeclaration(SEnumDeclaration node) → void
Visit a SEnumDeclaration.
inherited
visitExportDirective(SExportDirective node) → void
Visit a SExportDirective.
inherited
visitExpression(SExpression node) → void
Category fallback for all expression nodes.
inherited
visitExpressionFunctionBody(SExpressionFunctionBody node) → void
Visit a SExpressionFunctionBody.
inherited
visitExpressionStatement(SExpressionStatement node) → void
Visit a SExpressionStatement.
inherited
visitExtendsClause(SExtendsClause node) → void
Visit a SExtendsClause.
inherited
visitExtensionDeclaration(SExtensionDeclaration node) → void
Visit a SExtensionDeclaration.
inherited
visitExtensionTypeDeclaration(SExtensionTypeDeclaration node) → void
Visit a SExtensionTypeDeclaration.
inherited
visitFieldDeclaration(SFieldDeclaration node) → void
Visit a SFieldDeclaration.
inherited
visitFieldFormalParameter(SFieldFormalParameter node) → void
Visit a SFieldFormalParameter.
inherited
visitForEachParts(SForEachParts node) → void
Category fallback for for-each parts.
inherited
visitForEachPartsWithDeclaration(SForEachPartsWithDeclaration node) → void
Visit a SForEachPartsWithDeclaration.
inherited
visitForEachPartsWithIdentifier(SForEachPartsWithIdentifier node) → void
Visit a SForEachPartsWithIdentifier.
inherited
visitForEachPartsWithPattern(SForEachPartsWithPattern node) → void
Visit a SForEachPartsWithPattern.
inherited
visitForEachStatement(SForEachStatement node) → void
Visit a SForEachStatement.
inherited
visitForElement(SForElement node) → void
Visit a SForElement.
override
visitForLoopParts(SForLoopParts node) → void
Category fallback for all for-loop parts nodes.
inherited
visitFormalParameter(SFormalParameter node) → void
Category fallback for all formal parameter nodes.
inherited
visitFormalParameterList(SFormalParameterList node) → void
Visit a SFormalParameterList.
inherited
visitForParts(SForParts node) → void
Category fallback for traditional for-parts.
inherited
visitForPartsWithDeclarations(SForPartsWithDeclarations node) → void
Visit a SForPartsWithDeclarations.
inherited
visitForPartsWithExpression(SForPartsWithExpression node) → void
Visit a SForPartsWithExpression.
inherited
visitForStatement(SForStatement node) → void
Visit a SForStatement.
override
visitFunctionBody(SFunctionBody node) → void
Category fallback for all function body nodes.
inherited
visitFunctionDeclaration(SFunctionDeclaration node) → void
Visit a SFunctionDeclaration.
inherited
visitFunctionDeclarationStatement(SFunctionDeclarationStatement node) → void
Visit a SFunctionDeclarationStatement.
override
visitFunctionExpression(SFunctionExpression node) → void
Visit a SFunctionExpression.
override
visitFunctionExpressionInvocation(SFunctionExpressionInvocation node) → void
Visit a SFunctionExpressionInvocation.
inherited
visitFunctionReference(SFunctionReference node) → void
Visit a SFunctionReference.
inherited
visitFunctionTypedFormalParameter(SFunctionTypedFormalParameter node) → void
Visit a SFunctionTypedFormalParameter.
inherited
visitGenericFunctionType(SGenericFunctionType node) → void
Visit a SGenericFunctionType.
inherited
visitGuardedPattern(SGuardedPattern node) → void
Visit a SGuardedPattern.
inherited
visitHideCombinator(SHideCombinator node) → void
Visit a SHideCombinator.
inherited
visitIdentifier(SIdentifier node) → void
Category fallback for identifier nodes.
inherited
visitIfElement(SIfElement node) → void
Visit a SIfElement.
inherited
visitIfStatement(SIfStatement node) → void
Visit a SIfStatement.
inherited
visitImplementsClause(SImplementsClause node) → void
Visit a SImplementsClause.
inherited
visitImportDirective(SImportDirective node) → void
Visit a SImportDirective.
inherited
visitIndexExpression(SIndexExpression node) → void
Visit a SIndexExpression.
inherited
visitInstanceCreationExpression(SInstanceCreationExpression node) → void
Visit a SInstanceCreationExpression.
inherited
visitIntegerLiteral(SIntegerLiteral node) → void
Visit a SIntegerLiteral.
inherited
visitInterpolationElement(SInterpolationElement node) → void
Category fallback for all interpolation element nodes.
inherited
visitInterpolationExpression(SInterpolationExpression node) → void
Visit a SInterpolationExpression.
inherited
visitInterpolationString(SInterpolationString node) → void
Visit a SInterpolationString.
inherited
visitInvocationExpression(SInvocationExpression node) → void
Category fallback for invocation expression nodes.
inherited
visitIsExpression(SIsExpression node) → void
Visit a SIsExpression.
inherited
visitLabel(SLabel node) → void
Visit a SLabel.
inherited
visitLabeledStatement(SLabeledStatement node) → void
Visit a SLabeledStatement.
inherited
visitLibraryDirective(SLibraryDirective node) → void
Visit a SLibraryDirective.
inherited
visitListLiteral(SListLiteral node) → void
Visit a SListLiteral.
inherited
visitListPattern(SListPattern node) → void
Visit a SListPattern.
inherited
visitLiteral(SLiteral node) → void
Category fallback for all literal nodes.
inherited
visitLogicalAndPattern(SLogicalAndPattern node) → void
Visit a SLogicalAndPattern.
inherited
visitLogicalOrPattern(SLogicalOrPattern node) → void
Visit a SLogicalOrPattern.
inherited
visitMapLiteralEntry(SMapLiteralEntry node) → void
Visit a SMapLiteralEntry.
inherited
visitMapPattern(SMapPattern node) → void
Visit a SMapPattern.
inherited
visitMapPatternEntry(SMapPatternEntry node) → void
Visit a SMapPatternEntry.
inherited
visitMethodDeclaration(SMethodDeclaration node) → void
Visit a SMethodDeclaration.
override
visitMethodInvocation(SMethodInvocation node) → void
Visit a SMethodInvocation.
inherited
visitMixinDeclaration(SMixinDeclaration node) → void
Visit a SMixinDeclaration.
inherited
visitNamedCompilationUnitMember(SNamedCompilationUnitMember node) → void
Category fallback for named compilation unit members.
inherited
visitNamedExpression(SNamedExpression node) → void
Visit a SNamedExpression.
inherited
visitNamedType(SNamedType node) → void
Visit a SNamedType.
inherited
visitNamespaceDirective(SNamespaceDirective node) → void
Category fallback for namespace directives (import, export).
inherited
visitNativeFunctionBody(SNativeFunctionBody node) → void
Visit a SNativeFunctionBody.
inherited
visitNode(SAstNode node) → void
Default descent. Unlike the analyzer's GeneralizingAstVisitor, the mirror GeneralizingSAstVisitor.visitNode returns without recursing, so an un-overridden node would halt the walk. Recurse into children here so the resolver reaches nested blocks and identifier uses.
override
visitNormalFormalParameter(SNormalFormalParameter node) → void
Category fallback for normal (non-default) formal parameters.
inherited
visitNullAssertPattern(SNullAssertPattern node) → void
Visit a SNullAssertPattern.
inherited
visitNullAwareElement(SNullAwareElement node) → void
Visit a SNullAwareElement.
inherited
visitNullCheckPattern(SNullCheckPattern node) → void
Visit a SNullCheckPattern.
inherited
visitNullLiteral(SNullLiteral node) → void
Visit a SNullLiteral.
inherited
visitObjectPattern(SObjectPattern node) → void
Visit a SObjectPattern.
inherited
visitOnClause(SOnClause node) → void
Visit a SOnClause.
inherited
visitParenthesizedExpression(SParenthesizedExpression node) → void
Visit a SParenthesizedExpression.
inherited
visitParenthesizedPattern(SParenthesizedPattern node) → void
Visit a SParenthesizedPattern.
inherited
visitPartDirective(SPartDirective node) → void
Visit a SPartDirective.
inherited
visitPartOfDirective(SPartOfDirective node) → void
Visit a SPartOfDirective.
inherited
visitPatternAssignment(SPatternAssignment node) → void
Visit a SPatternAssignment.
inherited
visitPatternField(SPatternField node) → void
Visit a SPatternField.
inherited
visitPatternFieldName(SPatternFieldName node) → void
Visit a SPatternFieldName.
inherited
visitPatternVariableDeclaration(SPatternVariableDeclaration node) → void
Visit a SPatternVariableDeclaration.
inherited
visitPatternVariableDeclarationStatement(SPatternVariableDeclarationStatement node) → void
Visit a SPatternVariableDeclarationStatement.
inherited
visitPostfixExpression(SPostfixExpression node) → void
Visit a SPostfixExpression.
override
visitPrefixedIdentifier(SPrefixedIdentifier node) → void
Visit a SPrefixedIdentifier.
inherited
visitPrefixExpression(SPrefixExpression node) → void
Visit a SPrefixExpression.
override
visitPropertyAccess(SPropertyAccess node) → void
Visit a SPropertyAccess.
inherited
visitRecordLiteral(SRecordLiteral node) → void
Visit a SRecordLiteral.
inherited
visitRecordPattern(SRecordPattern node) → void
Visit a SRecordPattern.
inherited
visitRecordTypeAnnotation(SRecordTypeAnnotation node) → void
Visit a SRecordTypeAnnotation.
inherited
visitRecordTypeField(SRecordTypeField node) → void
Visit a SRecordTypeField.
inherited
visitRedirectingConstructorInvocation(SRedirectingConstructorInvocation node) → void
Visit a SRedirectingConstructorInvocation.
inherited
visitRelationalPattern(SRelationalPattern node) → void
Visit a SRelationalPattern.
inherited
visitRepresentationDeclaration(SRepresentationDeclaration node) → void
Visit a SRepresentationDeclaration.
inherited
visitRestPatternElement(SRestPatternElement node) → void
Visit a SRestPatternElement.
inherited
visitRethrowExpression(SRethrowExpression node) → void
Visit a SRethrowExpression.
inherited
visitReturnStatement(SReturnStatement node) → void
Visit a SReturnStatement.
inherited
visitSetOrMapLiteral(SSetOrMapLiteral node) → void
Visit a SSetOrMapLiteral.
inherited
visitShowCombinator(SShowCombinator node) → void
Visit a SShowCombinator.
inherited
visitSimpleFormalParameter(SSimpleFormalParameter node) → void
Visit a SSimpleFormalParameter.
inherited
visitSimpleIdentifier(SSimpleIdentifier node) → void
Visit a SSimpleIdentifier.
override
visitSimpleStringLiteral(SSimpleStringLiteral node) → void
Visit a SSimpleStringLiteral.
inherited
visitSingleStringLiteral(SSingleStringLiteral node) → void
Category fallback for single string literals (non-adjacent).
inherited
visitSpreadElement(SSpreadElement node) → void
Visit a SSpreadElement.
inherited
visitStatement(SStatement node) → void
Category fallback for all statement nodes.
inherited
visitStringInterpolation(SStringInterpolation node) → void
Visit a SStringInterpolation.
inherited
visitStringLiteral(SStringLiteral node) → void
Category fallback for string literals.
inherited
visitSuperConstructorInvocation(SSuperConstructorInvocation node) → void
Visit a SSuperConstructorInvocation.
inherited
visitSuperExpression(SSuperExpression node) → void
Visit a SSuperExpression.
inherited
visitSuperFormalParameter(SSuperFormalParameter node) → void
Visit a SSuperFormalParameter.
inherited
visitSwitchCase(SSwitchCase node) → void
Visit a SSwitchCase.
inherited
visitSwitchDefault(SSwitchDefault node) → void
Visit a SSwitchDefault.
inherited
visitSwitchExpression(SSwitchExpression node) → void
Visit a SSwitchExpression.
override
visitSwitchExpressionCase(SSwitchExpressionCase node) → void
Visit a SSwitchExpressionCase.
inherited
visitSwitchMember(SSwitchMember node) → void
Category fallback for all switch member nodes (case/default).
inherited
visitSwitchPatternCase(SSwitchPatternCase node) → void
Visit a SSwitchPatternCase.
inherited
visitSwitchStatement(SSwitchStatement node) → void
Visit a SSwitchStatement.
override
visitSymbolLiteral(SSymbolLiteral node) → void
Visit a SSymbolLiteral.
inherited
visitThisExpression(SThisExpression node) → void
Visit a SThisExpression.
inherited
visitThrowExpression(SThrowExpression node) → void
Visit a SThrowExpression.
inherited
visitTopLevelVariableDeclaration(STopLevelVariableDeclaration node) → void
Visit a STopLevelVariableDeclaration.
inherited
visitTryStatement(STryStatement node) → void
Visit a STryStatement.
inherited
visitTypeAnnotation(STypeAnnotation node) → void
Category fallback for all type annotation nodes.
inherited
visitTypeArgumentList(STypeArgumentList node) → void
Visit a STypeArgumentList.
inherited
visitTypedefDeclaration(STypedefDeclaration node) → void
Visit a STypedefDeclaration.
inherited
visitTypedLiteral(STypedLiteral node) → void
Category fallback for typed literals (list, set/map).
inherited
visitTypeParameter(STypeParameter node) → void
Visit a STypeParameter.
inherited
visitTypeParameterList(STypeParameterList node) → void
Visit a STypeParameterList.
inherited
visitUriBasedDirective(SUriBasedDirective node) → void
Category fallback for URI-based directives (import, export, part).
inherited
visitVariableDeclaration(SVariableDeclaration node) → void
Visit a SVariableDeclaration.
inherited
visitVariableDeclarationList(SVariableDeclarationList node) → void
Visit a SVariableDeclarationList.
inherited
visitVariableDeclarationStatement(SVariableDeclarationStatement node) → void
Visit a SVariableDeclarationStatement.
override
visitVariablePattern(SVariablePattern node) → void
Category fallback for variable patterns.
inherited
visitWhenClause(SWhenClause node) → void
Visit a SWhenClause.
inherited
visitWhileStatement(SWhileStatement node) → void
Visit a SWhileStatement.
override
visitWildcardPattern(SWildcardPattern node) → void
Visit a SWildcardPattern.
inherited
visitWithClause(SWithClause node) → void
Visit a SWithClause.
inherited
visitYieldStatement(SYieldStatement node) → void
Visit a SYieldStatement.
inherited

Operators

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