class Savi::Compiler::Sugar

Overview

The purpose of the Sugar pass is to expand universal shorthand forms, by filling in default ASTs where they are omitted, or transforming syntax sugar forms into their corresponding standard/canonical form, so that later passes can deal in less diverse, more predictable forms.

This pass uses copy-on-mutate patterns to "mutate" the Program topology. This pass uses copy-on-mutate patterns to "mutate" the AST. This pass does not raise any compilation errors. This pass keeps temporary state at the per-function level. This pass produces no output state.

Defined in:

savi/compiler/sugar.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Savi::AST::CopyOnMutateVisitor

visit(ctx : Compiler::Context, node : Node) visit, visit_any?(ctx : Compiler::Context, node : Node) visit_any?, visit_children?(ctx : Compiler::Context, node : Node) visit_children?, visit_pre(ctx : Compiler::Context, node : Node) visit_pre

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.cached_or_run(ctx, l, t, f, &) : Program::Function #

[View source]
def self.run(ctx, package) #

[View source]

Instance Method Detail

def next_local_name #

[View source]
def run(ctx, f) #

[View source]
def visit(ctx, node : AST::Qualify) #

[View source]
def visit(ctx, node : AST::Prefix) #

[View source]
def visit(ctx, node : AST::Relate) #

[View source]