class

Mint::Compiler::Js

Inherits Reference < Object

This class is responsible for creating a tree of JS code.

Constructors

new(optimize : Bool)
Source

Class methods

async?(items : Array(Compiled))
Source
async?(items : Compiled)
Source
async?(item : Item)
Source

Instance methods

array(items : Array(Compiled)) : Compiled

Renders an array.

Source
arrow_function(arguments : Array(Compiled) = [] of Compiled, &) : Compiled

Renders an arrow function.

Source
assign(name : Item | Compiled, value : Compiled) : Compiled

Renders an assignment.

Source
call(name : Item | Compiled, arguments : Array(Compiled)) : Compiled

Renders a call.

Source
const(name : Item | Compiled, value : Compiled) : Compiled

Renders a const assignment.

Source
constants(items : Array(Tuple(Ast::Node, Id, Compiled))) : Compiled

Renders multiple const assignments (as one).

Source
constants(items : Hash(String, Compiled)) : Compiled
Source
constants(assigns)
Source
for(variables : Compiled, subject : Compiled, &) : Compiled

Renders a for statement.

Source
if(condition : Compiled, body : Compiled) : Compiled

Renders an if statement.

Source
iif

Renders an immediately invoked function.

Source
import(imports : Hash(String, String), path : String) : Compiled

Renders an import statement.

Source
let(name : Item | Compiled, value : Compiled) : Compiled

Renders a let assignment.

Source
let(variables : Array(Variable)) : Compiled

Renders a let assignment with multiple variables.

Source
new(name : Item | Compiled, items : Array(Compiled) = [] of Compiled) : Compiled

Renders an initializer.

Source
null

Renders null.

Source
object(items : Hash(Item, Compiled)) : Compiled

Renders an object. The key can be any item but it's usually a string or an identifier.

Source
object_destructuring(items : Array(Compiled)) : Compiled

Renders an object destructuring.

Source
optimize?

Whether or not to optimize the output.

Source
return(item : Compiled) : Compiled

Renders a return statement.

Source
statements(items : Array(Compiled), *, line_count = 1) : Compiled

Renders statements.

Source
string(value : String) : Compiled

Renders a string using a template literal (``).

TODO: Check if a simple string is enough?

Source
ternary(condition : Compiled, truthy : Compiled, falsy : Compiled) : Compiled

Renders an ternary operator.

Source