class Mint::Compiler

Included Modules

Defined in:

compiler.cr
compiler/decoder.cr
compiler/encoder.cr
compiler/js.cr
compiler/renderer.cr
compilers/access.cr
compilers/argument.cr
compilers/array_literal.cr
compilers/await.cr
compilers/block.cr
compilers/bool_literal.cr
compilers/bracket_access.cr
compilers/builtin.cr
compilers/call.cr
compilers/case.cr
compilers/case_branch.cr
compilers/component.cr
compilers/constant.cr
compilers/dbg.cr
compilers/decode.cr
compilers/defer.cr
compilers/destructuring.cr
compilers/directives/asset.cr
compilers/directives/format.cr
compilers/directives/highlight.cr
compilers/directives/highlight_file.cr
compilers/directives/inline.cr
compilers/directives/svg.cr
compilers/emit.cr
compilers/encode.cr
compilers/env.cr
compilers/field.cr
compilers/field_access.cr
compilers/for_expression.cr
compilers/function.cr
compilers/get.cr
compilers/here_document.cr
compilers/html_attribute.cr
compilers/html_component.cr
compilers/html_element.cr
compilers/html_fragment.cr
compilers/if.cr
compilers/inline_function.cr
compilers/interpolation.cr
compilers/js.cr
compilers/locale_key.cr
compilers/map.cr
compilers/map_field.cr
compilers/module.cr
compilers/negated_expression.cr
compilers/next_call.cr
compilers/number_literal.cr
compilers/operation.cr
compilers/parenthesized_expression.cr
compilers/pipe.cr
compilers/provider.cr
compilers/record.cr
compilers/record_update.cr
compilers/regexp_literal.cr
compilers/return_call.cr
compilers/route.cr
compilers/signal.cr
compilers/state.cr
compilers/state_setter.cr
compilers/statement.cr
compilers/store.cr
compilers/string.cr
compilers/string_literal.cr
compilers/suite.cr
compilers/test.cr
compilers/tuple_literal.cr
compilers/type_definition.cr
compilers/unary_minus.cr
compilers/variable.cr

Constructors

Instance Method Summary

Instance methods inherited from module Mint::Helpers

owns?(node : Ast::Node, parent : Ast::Node) : Bool owns?, static?(nodes : Array(Ast::Node)) : Bool
static?(node : Ast::Node | Nil) : Bool
static?
, static_value(nodes : Array(Ast::Node), separator : Char | Nil = nil) : String
static_value(node : Ast::Node | Nil) : String | Nil
static_value

Instance methods inherited from module Mint::Errorable

error!(name : Symbol, &) error!, unreachable!(message : String) unreachable!

Constructor Detail

def self.new(artifacts : Mint::TypeChecker::Artifacts, css_prefix, config : Mint::Bundler::Config) #

[View source]

Instance Method Detail

def add(node : Ast::Node, id : Id, value : Compiled) #

Adds a compiled entity.


[View source]
def add(items : Array(Tuple(Ast::Node, Id, Compiled) | Nil)) #

Adds multiple compiled entities.


[View source]
def artifacts : TypeChecker::Artifacts #

The type checker artifacts.


[View source]
def ast(*args, **options) #

[View source]
def ast(*args, **options, &) #

[View source]
def cache(*args, **options) #

[View source]
def cache(*args, **options, &) #

[View source]
def checked(*args, **options) #

[View source]
def checked(*args, **options, &) #

[View source]
def compile(items : Array(Ast::CssDefinition), block : Proc(String, String) | Nil) : Compiled #

[View source]
def compile(nodes : Array(Ast::Node), separator : String) : Compiled #

Compiles multiple nodes and joins them with the separator.


[View source]
def compile(node : Ast::Access) : Compiled #

[View source]
def compile(node : Ast::Argument) : Compiled #

[View source]
def compile(node : Ast::ArrayLiteral) : Compiled #

[View source]
def compile(node : Ast::Await) : Compiled #

[View source]
def compile(node : Ast::Block, for_function = false) : Compiled #

[View source]
def compile(node : Ast::BoolLiteral) : Compiled #

[View source]
def compile(node : Ast::BracketAccess) : Compiled #

[View source]
def compile(node : Ast::Builtin) : Compiled #

[View source]
def compile(node : Ast::Call) : Compiled #

[View source]
def compile(node : Ast::Case, block : Proc(String, String) | Nil = nil) : Compiled #

[View source]
def compile(node : Ast::CaseBranch, block : Proc(String, String) | Nil = nil) : Compiled #

[View source]
def compile(node : Ast::Dbg) : Compiled #

[View source]
def compile(node : Ast::Decode) : Compiled #

[View source]
def compile(node : Ast::Defer) : Compiled #

[View source]
def compile(node : Ast::Emit) : Compiled #

[View source]
def compile(node : Ast::Encode) : Compiled #

[View source]
def compile(node : Ast::Env) : Compiled #

[View source]
def compile(node : Ast::Field) #

[View source]
def compile(node : Ast::FieldAccess) : Compiled #

[View source]
def compile(node : Ast::For) : Compiled #

[View source]
def compile(node : Ast::Function) #

[View source]
def compile(node : Ast::HereDocument) : Compiled #

[View source]
def compile(node : Ast::HtmlComponent) : Compiled #

[View source]
def compile(node : Ast::HtmlElement) : Compiled #

[View source]
def compile(node : Ast::HtmlFragment) : Compiled #

[View source]
def compile(node : Ast::If, block : Proc(String, String) | Nil = nil) : Compiled #

[View source]
def compile(node : Ast::InlineFunction) : Compiled #

[View source]
def compile(node : Ast::Interpolation) : Compiled #

[View source]
def compile(node : Ast::Js) : Compiled #

[View source]
def compile(node : Ast::LocaleKey) : Compiled #

[View source]
def compile(node : Ast::Map) : Compiled #

[View source]
def compile(node : Ast::MapField) #

[View source]
def compile(node : Ast::NegatedExpression) : Compiled #

[View source]
def compile(node : Ast::NextCall) : Compiled #

[View source]
def compile(node : Ast::NumberLiteral) : Compiled #

[View source]
def compile(node : Ast::Operation) : Compiled #

[View source]
def compile(node : Ast::ParenthesizedExpression) : Compiled #

[View source]
def compile(node : Ast::Pipe) : Compiled #

[View source]
def compile(node : Ast::Record) : Compiled #

[View source]
def compile(node : Ast::RecordUpdate) : Compiled #

[View source]
def compile(node : Ast::RegexpLiteral) : Compiled #

[View source]
def compile(node : Ast::ReturnCall) : Compiled #

[View source]
def compile(node : Ast::Route) : Compiled #

[View source]
def compile(node : Ast::StateSetter) : Compiled #

[View source]
def compile(node : Ast::Statement) : Compiled #

[View source]
def compile(value : String) : Compiled #

[View source]
def compile(node : Ast::StringLiteral, quote : Bool = false) : Compiled #

[View source]
def compile(node : Ast::Suite) : Compiled #

[View source]
def compile(node : Ast::Test) : Compiled #

[View source]
def compile(node : Ast::TupleLiteral) : Compiled #

[View source]
def compile(node : Ast::UnaryMinus) : Compiled #

[View source]
def compile(node : Ast::Variable) : Compiled #

[View source]
def compile(node : Ast::Directives::Asset) : Compiled #

[View source]
def compile(node : Ast::Directives::Format) : Compiled #

[View source]
def compile(node : Ast::Directives::Highlight) : Compiled #

[View source]
def compile(node : Ast::Directives::HighlightFile) : Compiled #

[View source]
def compile(node : Ast::Directives::Inline) : Compiled #

[View source]
def compile(node : Ast::Directives::Svg) : Compiled #

[View source]
def compile(nodes : Array(Ast::Node)) : Array(Compiled) #

Compiles multiple nodes.


[View source]
def compile(node : Ast::Node) : Compiled #

Fallback for compiling a node.


[View source]
def compile(node : Ast::Function, *, contents : Compiled | Nil = nil, args : Array(Compiled) | Nil = nil, skip_const : Bool = false) : Compiled #

[View source]
def compile(value : Array(Ast::Node | String), *, quote_string : Bool = false) : Compiled #

[View source]
def compile(node : Ast::Node, &) : Compiled #

Compiles a node. If the node is already compiled or not checked it returns an empty compiled node.


[View source]

Contains the compiled JavaScript tree.


[View source]
def components_touched(*args, **options) #

[View source]
def components_touched(*args, **options, &) #

[View source]
def config : Bundler::Config #

The compiler config.


[View source]
def decoder(type : TypeChecker::Record) : Compiled #

[View source]
def decoder(type : TypeChecker::Type) : Compiled #

[View source]
def decoder(node : TypeChecker::Variable) #

[View source]

Contains the generated decoders.


[View source]
def defer(node : Ast::Node, compiled : Compiled) #

[View source]
def destructuring(node : Ast::ArrayDestructuring, variables : Array(Compiled)) : Compiled #

[View source]
def destructuring(node : Ast::TupleDestructuring, variables : Array(Compiled)) : Compiled #

[View source]
def destructuring(node : Ast::Variable, variables : Array(Compiled)) : Compiled #

[View source]
def destructuring(node : Ast::Discard, variables : Array(Compiled)) : Compiled #

[View source]
def destructuring(node : Ast::Spread, variables : Array(Compiled)) : Compiled #

[View source]
def destructuring(node : Ast::TypeDestructuring, variables : Array(Compiled)) : Compiled #

[View source]
def destructuring(node : Ast::Node, variables : Array(Compiled)) : Compiled #

[View source]
def destructuring(node : Nil, variables : Array(Compiled)) : Compiled #

[View source]
def encoder(type : TypeChecker::Record) : Compiled #

[View source]
def encoder(type : TypeChecker::Type) : Compiled #

[View source]
def encoder(node : TypeChecker::Variable) #

[View source]

Contains the generated encoders.


[View source]
def err #

[View source]
def js : Js #

The JavaScript builder instance.


[View source]
def just #

[View source]
def lookups(*args, **options) #

[View source]
def lookups(*args, **options, &) #

[View source]
def match(condition : Ast::Node, branches : Array(Tuple(Ast::Node | Nil, Compiled))) : Compiled #

[View source]
def maybe #

[View source]
def nothing #

[View source]
def ok #

[View source]
def program : Compiled #

Compiles the program call.


[View source]
def record_field_lookup(*args, **options) #

[View source]
def record_field_lookup(*args, **options, &) #

[View source]
def resolve(node : Ast::Component) #

[View source]
def resolve(node : Ast::Constant) #

[View source]
def resolve(node : Ast::Field) : Hash(Item, Compiled) #

[View source]
def resolve(node : Ast::Function) #

[View source]
def resolve(node : Ast::Get) #

[View source]
def resolve(node : Ast::Module) #

[View source]
def resolve(node : Ast::Provider) #

[View source]
def resolve(node : Ast::Signal) #

[View source]
def resolve(node : Ast::State) #

[View source]
def resolve(node : Ast::Store) #

[View source]
def resolve(node : Ast::TypeDefinition) #

[View source]
def resolve(nodes : Array(Ast::Node)) #

Resolves top-level nodes.


[View source]
def resolve(node : Ast::Node) #

Fallback resolving nodes.


[View source]
def resolve(node : Ast::HtmlAttribute, *, is_element = true) : Hash(Item, Compiled) #

[View source]
def resolve(node : Ast::Node, &) #

Resolves a top-level node.


[View source]
def resolve_order(*args, **options) #

[View source]
def resolve_order(*args, **options, &) #

[View source]
def result #

[View source]
def style_builder : StyleBuilder #

The style builder instance.


[View source]
def test(*, url, id, glob) : Compiled #

Compile test runner.


[View source]
def tokenize(ast : Ast) : Compiled #

[View source]
def touched : Set(Ast::Node) #

A set to track already rendered nodes.


[View source]
def translations : Array(Compiled) #

Translations


[View source]
def variables(*args, **options) #

[View source]
def variables(*args, **options, &) #

[View source]