ast library
Serializable AST model for Dart source code.
This library provides a complete, serializable AST representation that can be used for interpretation, code analysis, and transformation.
This library has NO dependency on the Dart analyzer package.
Classes
-
GeneralizingSAstVisitor<
T> - A visitor that adds category-level fallback methods between specific visit methods and visitNode.
- SAdjacentStrings
- SAnnotatedNode
-
Base class for nodes that have documentation comments and metadata.
Mirrors analyzer's
AnnotatedNode. - SAnnotation
- SArgumentList
- SAsExpression
- SAssertInitializer
- SAssertStatement
- SAssignedVariablePattern
- An assigned variable pattern that binds to an existing variable.
- SAssignmentExpression
- SAstNode
- Base class for all serializable AST nodes
- SAstNodeFactory
- Factory for deserializing AST nodes
-
SAstVisitor<
T> - A visitor for the serializable AST node hierarchy.
- SAwaitExpression
- SBinaryExpression
- SBlock
- SBlockFunctionBody
- SBooleanLiteral
- SBreakStatement
- SCascadeExpression
- SCaseClause
-
A
caseclause used in if-case statements. - SCastPattern
-
A cast pattern (e.g.,
pattern as Type). - SCatchClause
- SClassDeclaration
- SClassMember
-
Base class for class members (methods, fields, constructors).
Mirrors analyzer's
ClassMember. - SCollectionElement
-
Base class for collection elements (expressions, spread, if/for elements, map entries).
Mirrors analyzer's
CollectionElement. - SCombinator
-
Base class for show/hide combinators on directives.
Mirrors analyzer's
Combinator. - SComment
- SCompilationUnit
- A complete Dart compilation unit (file)
- SCompilationUnitMember
-
Base class for compilation unit members (top-level declarations).
Mirrors analyzer's
CompilationUnitMember. - SConditionalExpression
- SConstantPattern
-
A constant expression pattern (e.g.,
case 42:,case const Foo():). - SConstructorDeclaration
- SConstructorFieldInitializer
- SConstructorInitializer
-
Base class for constructor initializers.
Mirrors analyzer's
ConstructorInitializer. - SConstructorName
- SConstructorReference
-
A constructor reference expression:
MyClass.neworMyClass<T>.named - SContinueStatement
- SDartPattern
-
Base class for Dart patterns (Dart 3 pattern matching).
Mirrors analyzer's
DartPattern. - SDeclaration
-
Base class for all declarations.
Mirrors analyzer's
Declaration. - SDeclaredIdentifier
- Declared identifier in a for-each loop
- SDeclaredVariablePattern
-
A declared variable pattern (e.g.,
var x,int x,final String name). - SDefaultFormalParameter
- SDirective
-
Base class for all directives (import, export, part, library).
Mirrors analyzer's
Directive. - SDoStatement
- SDoubleLiteral
- SEmptyFunctionBody
- SEmptyStatement
- SEnumConstantDeclaration
- SEnumDeclaration
- SExportDirective
- SExpression
-
Base class for all expressions. Extends CollectionElement because
expressions can appear in collection literals.
Mirrors analyzer's
Expression. - SExpressionFunctionBody
- SExpressionStatement
- SExtendsClause
- SExtensionDeclaration
- SExtensionTypeDeclaration
-
An extension type declaration:
extension type MyType(int value) implements int { ... } - SFieldDeclaration
- SFieldFormalParameter
- SForEachParts
-
Base class for for-each loop parts.
Mirrors analyzer's
ForEachParts. - SForEachPartsWithDeclaration
- For-each loop parts with a declaration
- SForEachPartsWithIdentifier
- For-each loop parts with an identifier
- SForEachPartsWithPattern
- For-each loop parts with a pattern destructuring on each element.
- SForEachStatement
- SForElement
- SForLoopParts
-
Base class for for-loop parts.
Mirrors analyzer's
ForLoopParts. - SFormalParameter
-
Base class for formal parameters.
Mirrors analyzer's
FormalParameter. - SFormalParameterList
- SForParts
-
Base class for traditional for-loop parts.
Mirrors analyzer's
ForParts. - SForPartsWithDeclarations
- For loop parts for standard for loops
- SForPartsWithExpression
- For loop parts with an expression initializer
- SForStatement
- SFunctionBody
-
Base class for function bodies.
Mirrors analyzer's
FunctionBody. - SFunctionDeclaration
- SFunctionDeclarationStatement
- SFunctionExpression
- SFunctionExpressionInvocation
- SFunctionReference
-
A function reference expression:
myFunc<int>(tear-off with type args) - SFunctionTypedFormalParameter
- SGenericFunctionType
- SGuardedPattern
-
A pattern with an optional
whenguard clause. - SHideCombinator
- SIdentifier
-
Base class for identifiers (simple and prefixed).
Mirrors analyzer's
Identifier. - SIfElement
- SIfStatement
- SImplementsClause
- SImportDirective
- SIndexExpression
- SInstanceCreationExpression
- SIntegerLiteral
- SInterpolationElement
-
Base class for string interpolation elements.
Mirrors analyzer's
InterpolationElement. - SInterpolationExpression
- SInterpolationString
- SInvocationExpression
-
Base class for invocation expressions (method calls, function calls).
Mirrors analyzer's
InvocationExpression. - SIsExpression
- SLabel
- SLabeledStatement
- SLibraryDirective
- SListLiteral
- SListPattern
-
A list destructuring pattern (e.g.,
[a, b, ...rest]). - SLiteral
-
Base class for all literals.
Mirrors analyzer's
Literal. - SLogicalAndPattern
-
A logical AND pattern (e.g.,
pattern1 && pattern2). - SLogicalOrPattern
-
A logical OR pattern (e.g.,
pattern1 || pattern2). - SMapLiteralEntry
- SMapPattern
-
A map destructuring pattern (e.g.,
{'key': valuePattern}). - SMapPatternEntry
-
A single entry in a map pattern (e.g.,
key: valuePattern). - SMethodDeclaration
- SMethodInvocation
- SMixinDeclaration
- SNamedCompilationUnitMember
-
Base class for named compilation unit members.
Mirrors analyzer's
NamedCompilationUnitMember. - SNamedExpression
- SNamedType
- SNamespaceDirective
-
Base class for namespace directives (import, export).
Mirrors analyzer's
NamespaceDirective. - SNativeFunctionBody
- SNormalFormalParameter
-
Base class for normal (non-default) formal parameters.
Mirrors analyzer's
NormalFormalParameter. - SNullAssertPattern
-
A null-assert pattern (e.g.,
pattern!). - SNullAwareElement
-
Represents a null-aware element in a collection literal (
?expr). - SNullCheckPattern
-
A null-check pattern (e.g.,
pattern?). - SNullLiteral
- SObjectPattern
-
An object destructuring pattern (e.g.,
MyType(field: pattern)). - SOnClause
- SParenthesizedExpression
- SParenthesizedPattern
-
A parenthesized pattern (e.g.,
(pattern)). - SPartDirective
- SPartOfDirective
- SPatternAssignment
-
A pattern assignment expression:
(a, b) = expr - SPatternField
- A field in an object or record pattern.
- SPatternFieldName
- A field name identifier in a pattern field (null name for shorthand).
- SPatternVariableDeclaration
-
A pattern variable declaration (e.g.,
var (a, b) = expr). - SPatternVariableDeclarationStatement
-
A pattern variable declaration statement:
var (a, b) = expr; - SPostfixExpression
- SPrefixedIdentifier
- SPrefixExpression
- SPropertyAccess
- SRecordLiteral
- SRecordPattern
-
A record destructuring pattern (e.g.,
(pattern, name: pattern)). - SRecordTypeAnnotation
- SRedirectingConstructorInvocation
- SRelationalPattern
-
A relational pattern (e.g.,
< 5,>= 10). - SRepresentationDeclaration
-
The representation declaration of an extension type:
(int value) - SRestPatternElement
-
A rest element in a list or map pattern (e.g.,
...subPattern). - SRethrowExpression
- SReturnStatement
- SSetOrMapLiteral
- SShowCombinator
- SSimpleFormalParameter
- SSimpleIdentifier
- SSimpleStringLiteral
- SSingleStringLiteral
-
Base class for single string literals (non-adjacent).
Mirrors analyzer's
SingleStringLiteral. - SSpreadElement
- SStatement
-
Base class for all statements.
Mirrors analyzer's
Statement. - SStringInterpolation
- SStringLiteral
-
Base class for string literals.
Mirrors analyzer's
StringLiteral. - SSuperConstructorInvocation
- SSuperExpression
- SSuperFormalParameter
- SSwitchCase
- SSwitchDefault
- SSwitchExpression
-
A switch expression:
switch (expr) { case1 => val1, ... } - SSwitchExpressionCase
-
A case in a switch expression (e.g.,
pattern => expression). - SSwitchMember
-
Base class for switch case/default members.
Mirrors analyzer's
SwitchMember. - SSwitchPatternCase
- A Dart 3.0 switch statement case with pattern matching.
- SSwitchStatement
- SSymbolLiteral
- StaticResolver
- Static lexical resolver (plan_3 §4.4 / §9 S1–S2), operating directly on the serializable mirror AST.
- SThisExpression
- SThrowExpression
- SToken
- Serializable token representation
- STopLevelVariableDeclaration
- STryStatement
- STypeAnnotation
-
Base class for type annotations.
Mirrors analyzer's
TypeAnnotation. - STypeArgumentList
- STypedefDeclaration
- STypedLiteral
-
Base class for typed literals (list, set/map).
Mirrors analyzer's
TypedLiteral. - STypeParameter
- STypeParameterList
- SUriBasedDirective
-
Base class for uri-based directives (import, export, part).
Mirrors analyzer's
UriBasedDirective. - SVariableDeclaration
- SVariableDeclarationList
- SVariableDeclarationStatement
- SVariablePattern
-
Base class for variable patterns.
Mirrors analyzer's
VariablePattern. - SWhenClause
-
A
whenclause that guards a pattern with a boolean expression. - SWhileStatement
- SWildcardPattern
-
A wildcard pattern
_, optionally typed (e.g.,int _,var _). - SWithClause
- SYieldStatement
Mixins
- SFunctionBodyOwner
- Mixin for declarations with a function body
- SNamedDeclaration
- Mixin for named declarations
Functions
-
opensLexicalFrame(
SAstNode node) → bool -
Does
nodeopen a new runtimeEnvironmentframe?