@@ -30,6 +30,29 @@ static initializers of a class and perform the following transformations:
3030
3131 /smallskip
3232 During elaboration, elaborated members will be wrapped into elab().
33+
34+ During elaboration an expression transition through 6 phases:
35+ 1 . Elaboration heating:
36+ elab('CastRef(_,, ' Minus('ExprName(x))))
37+ => elab(' Minus('ExprName(x)) ~> elab(' CastRef(_,, HOLE)
38+ Some AST terms, especially some statements require custom elaboration heating rules. If the heated expression
39+ should be always computed into a KResult, such as a type , package or certain literal expresssions, then
40+ it is heated in the "naked" form, e.g. not wrapped into elab().
41+ 2 . Elaboration of children. All the children of the expression are elaborated. After this phase elaborated children
42+ will be wrapped into ElabRes() (If They are expressions). The expression above would reach the state:
43+ elab('Minus(elabRes(localVar(X)::int))) ~> elab(' CastRef(_,, HOLE)
44+ 3 . Initiation of the step elabDispose. When all children have been elaborated and are either KResult of elabRes(),
45+ the wrapper is changed from elab() to elabDispose().
46+ elabDispose('Minus(elabRes(localVar(X)::int))) ~> elab(' CastRef(_,, HOLE)
47+ 4 . Unwrapping of children. During elabDispose step elaborated children are unwrapped from their elabRes() wrapper.
48+ elabDispose('Minus(localVar(X)::int)) ~> elab(' CastRef(_,, HOLE)
49+ 5 . Computation of elaboration result. Now that all children have been elaborated and unwrapped, it is possible to
50+ compute the type of the current expression itself. When the expression is fully elaborated, it is wrapped into
51+ elabRes(). This is the step that requires custom rules for most AST terms.
52+ elabRes('Minus(localVar(X)::int)::int) ~> elab(' CastRef(_,, HOLE)
53+ 6 . Elaboration cooling. Once the top K Item was wrapped into elabRes, it is ready to be cooled back into its original
54+ context:
55+ elab('CastRef(_,, elabRes(' Minus(localVar(X)::int )::int ))
3356*/
3457
3558module ELABORATE-BLOCKS
0 commit comments