• A
    Initial tree data structure for closure conversion (#20715) · b867e8e7
    Andy Gocke 提交于
    This PR adds the initial work for a new closure conversion design based around a tree instead of a series of dictionaries. The tree should
    
    Make it easier to assert invariants as we perform rewriting.
    Make debugging simpler.
    Allow us to move to a series of cheap, simple passes over the simplified tree, rather than one, very complicated pass over the bound tree.
    Make it easier to move almost all logic into the analysis phase and make rewriting a simple mechanical transformation.
    The heart of the new design is the Scope tree, which consists of a series of nested Scopes, each of which hold relevant information about what variables and closures are declared in that scope. The Closure, meanwhile, holds information for each closure, including a list of captured variables. By carefully visiting the bound node once we should be able to encode all relevant information into the Scope tree, and then iterate over a series of quick, simple passes to create the fully converted form.
    b867e8e7
LambdaRewriter.Analysis.cs 27.9 KB