The Analysis phase determines if the parsed AST type checks and resolves properly.
As part of this phase, we have access to events happening before and after resolution.
Before resolution, we are given the chance to modify the compiler trees in the form of KtElement
via
the Quote Template System.
(extensions in package arrow.meta.plugins.proofs.phases) |
””” $@annotations
$expression “”“.annotatedExpression
(extensions in package arrow.meta.quotes) |
CLI bootstrap service
When the compiler goes to codegen, and IR is not enabled by default, it goes into the codegen phase for the JVM where it uses the ASM libs to generate bytecode using the AST and associated descriptors coming from the resolution phase.
””“$left $operationReference $right””“.binaryExpression
””“$statements””“.block
”"”break$targetLabel”””.break
(extensions in package arrow.meta.phases.codegen.ir) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve.scopes) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
”"”catch ($parameter) ${ catchBody }
””“.catch
”””{ $properties $companionObjects $functions }””“.classBody
"""|$`@annotations` $kind $name $`(typeParameters)` $`(params)` : $supertypes"} { $body } """.`class
`
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
(extensions in package arrow.meta.quotes) |
A template destructuring Scope for a KtClassOrObject
An Arrow Meta CliPlugin is a named function that given a CompilerContext produces a List of ExtensionPhase.
The Compiler Context represents the environment received by all plugins. The Compiler Context will get more services as they become relevant overtime to the development of compiler plugins.
The configuration phase allows changing the compiler configuration prior to compilation. In this phase, we can programmatically activate and change all compiler flags and system properties the compiler uses to enable/disable the different features in compilation.
”"”continue”””.continue
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
(extensions in package arrow.meta.quotes) |
Default impl for element scopes based on the KtPsiFactory
””“$valOrVar ($entries) = $initializer “”“.destructuringDeclaration
(extensions in package arrow.meta.plugins.higherkind) |
””“$receiverExpression.$selectorExpression””“.dotQualifiedExpression
A template destructuring Scope for a KtExpressionWithLabel
An ExtensionPhase represents a subscription to one of the Kotlin compiler phases.
file(name, “”” $packageDirective $importList $classes “””)
”"”finally { $finallyExpression }””“.finally
”"”for ($(param)
in $loopRange) $body”””.for
(extensions in package arrow.meta.plugins.higherkind) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve.scopes) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
”””{$(params)
$blockExpression}””“.functionLiteral
A template destructuring Scope for a KtFunctionNotStubbed
”"”if ($condition) $then else $else
”””.if
importDirective(ImportPath(importedFqName, isAllUnder, alias))
(extensions in package arrow.meta.phases.codegen.ir) |
(extensions in package arrow.meta.phases.codegen.ir) |
The codegen phase is where the compiler emits bytecode and metadata for the different platforms the Kotlin language targets. In this phase, by default, the compiler would go into ASM codegen for the JVM, or into IR codegen if IR is enabled. IR is the Intermediate Representation format the new Kotlin compiler backend targets.
(extensions in package arrow.meta.phases.codegen.ir) |
””“$left $operation $type”””.is
(extensions in package arrow.meta.internal) |
(extensions in package arrow.meta.phases.resolve) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
(extensions in package arrow.meta.phases.analysis) |
(extensions in package arrow.meta.plugins.proofs.phases) |
(extensions in package arrow.meta.internal) |
(extensions in package arrow.meta.phases.analysis) |
(extensions in package arrow.meta.plugins.higherkind) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
(extensions in package arrow.meta.quotes) |
(extensions in package arrow.meta.phases.analysis.diagnostic) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
(extensions in package arrow.meta.phases.analysis) |
(extensions in package arrow.meta.phases.analysis) |
(extensions in package arrow.meta.quotes) |
(extensions in package arrow.meta.phases.analysis) |
(extensions in package arrow.meta.plugins.proofs.phases.quotes) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
lambdaExpression(“””$(params)
”””, “”“$bodyExpression”””)
(extensions in package arrow.meta.internal) |
(extensions in package arrow.meta.phases.analysis) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
A base template destructuring Scope for all KtLoopExpression AST elements
(extensions in package arrow.meta.internal) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
Meta is the core entry point and impl of Arrow Meta in terms of its registration system and interface with the Kotlin Compiler
Provides interception access to the internals of a VirtualFile allowing to replace its Document
The Meta Plugin contains the default meta bundled plugins for Arrow
””” $@annotations
$modifier value “””.modifierList
(extensions in package arrow.meta.plugins.proofs.phases) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve.cache) |
””” $modality $visibility fun $(typeParameters)
$receiver.$name $(args)
: $returnType = { $body } “”“.namedFunction
””” object $name { $body }””“.objectDeclaration
””” $package
“””.package
(extensions in package arrow.meta.quotes) |
””” $name : $type””“.classParameter
””” $(params)
“”“.parameterList
””” $modality $visibility $valOrVar $name $returnType $initializer “”“.property
””” var $name $returnType $initializer $visibility get $(params)
$bodyExpression” ““.propertyAccessorGet
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
(extensions in package arrow.meta.phases.analysis) |
(extensions in package arrow.meta.plugins.proofs.phases.resolve) |
The Resolve phase is in charge of providing the meaning of the Kotlin Language to the structured trees discovered by the Kotlin parser. Right up until Analysis, we are just working with a tree structure—the AST. In resolution, we proceed to type-check the AST and all its expressions, associating each of them to a DeclarationDescriptor. A DeclarationDescriptor is a model that contains the type and Kotlin structure, as it understands our sources in the AST.
”"”return”””.return
The property scope used in destructuring templates & the arrow.meta.phases.analysis.ElementScope DSL
(extensions in package arrow.meta) |
(extensions in package arrow.meta.internal) |
(extensions in package arrow.meta.plugins.optics.internals) |
””“$instanceReference$targetLabel”””.this
”"”throw $thrownExpression”””.throw
The resulting action from matching on transformation
”"”try $tryBlock$catchClauses$finallySection”””.try
typeAlias(“”“$name”””, (typeParameters)
.toStringList() , “”“$type”””)
A template destructuring Scope for a KtExpressionWithLabel
A template destructuring Scope for a TypeReference.
(if (!argumentName.toString().isNullOrEmpty()) “”“$argumentName = $argumentExpression””” else “”“$argumentExpression”””).argument
condition.whenCondition
(if (!isElse) “”“$conditions -> $expression””” else “"”else -> $expression”””).whenEntry
A template destructuring Scope for a KtWhenExpression.
”"”while ($condition) $body”””.while
Do you like Arrow?
✖