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
- Mint::Compiler
- Mint::Compiler2
- Mint::DocumentationGenerator
- Mint::Formatter
- Mint::Parser
- Mint::TypeChecker
Defined in:
helpers.crInstance Method Summary
- #async?(node : Ast::Node) : Bool
-
#covers?(node : Ast::ArrayDestructuring, length : Int32) : Bool
Returns true if the destructuring covers arrays with the given length.
-
#exhaustive?(node : Ast::Node) : Bool
Returns whether the destructuring is exhaustive.
- #owns?(node : Ast::Node, parent : Ast::Node) : Bool
-
#spread?(node : Ast::ArrayDestructuring) : Bool
Returns whether there are any spreads in the items.
- #static?(nodes : Array(Ast::Node)) : Bool
- #static?(node : Ast::Node | Nil) : Bool
- #static_value(nodes : Array(Ast::Node), separator : Char | Nil = nil) : String
- #static_value(node : Ast::Node | Nil) : String | Nil
Instance Method Detail
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
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")
def spread?(node : Ast::ArrayDestructuring) : Bool
#
Returns whether there are any spreads in the items.