module Mint::Helpers

Overview

This module contains helper functions which are used in many parts of the process (parser, compiler, type checker, ect...).

Direct including types

Defined in:

helpers.cr

Instance Method Summary

Instance Method Detail

def async?(node : Ast::Node) : Bool #

[View source]
def covers?(node : Ast::ArrayDestructuring, length : Int32) : Bool #

Returns true if the destructuring covers arrays with the given length.

[x, ...rest] => 1+ [x] => 1 [...rest] => 0+ [] => 0


[View source]
def exhaustive?(node : Ast::Node) : Bool #

Returns whether the destructuring is exhaustive.

TODO We want to support cases like this:

type Test { Branch(String) }

let Test::Branch(value) = Test::Branch("Hello")


[View source]
def owns?(node : Ast::Node, parent : Ast::Node) : Bool #

[View source]
def spread?(node : Ast::ArrayDestructuring) : Bool #

Returns whether there are any spreads in the items.


[View source]
def static?(nodes : Array(Ast::Node)) : Bool #

[View source]
def static?(node : Ast::Node | Nil) : Bool #

[View source]
def static_value(nodes : Array(Ast::Node), separator : Char | Nil = nil) : String #

[View source]
def static_value(node : Ast::Node | Nil) : String | Nil #

[View source]