LEVIATHAN v962456e · 962456eee1

Standard Library · expr

class Call

A method call on a receiver, such as u.name.like("A%").

since 0.1.0-alpha.1linuxwindowswasm

bases
Node

Overview

Only a fixed set of calls can appear in a reified lambda: like, ilike, startsWith, endsWith and contains on a string, and contains on an array. When the receiver is an array, it appears as a Bind whose slot in binds holds None.

Examples

Array<expr::Node> args = [expr::Lit("%son")];
expr::Node tree = expr::Call("like", expr::Field(["name"]), args);
match (tree) {
    expr::Call => {
        expr::Call c = tree;
        console.writeln("${c.name} with ${c.args.length()} argument");
    }
    else => { console.writeln("not a Call"); }
}
like with 1 argument

Constructors

new

new(string n, Node receiver, Array<Node> a)

Create a call node.

Parameters

n
The method name.
receiver
The expression the method is called on.
a
The call arguments, in order.

Examples

Array<expr::Node> args = [expr::Lit("A%")];
expr::Call c = expr::Call("like", expr::Field(["name"]), args);
console.writeln(c.name);
console.writeln(c.args.length());
like
1

Fields

args

Array<Node> args

The call arguments, in order.

name

string name

The method name, for example "like".

recv

Node recv

The expression the method is called on.

See also

  • Bind — A captured value, referred to by its position in the binds array of the enclosing expr::Expr.