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
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
The call arguments, in order.
name
string nameThe method name, for example "like".
recv
Node recvThe expression the method is called on.
See also
- Bind — A captured value, referred to by its position in the
bindsarray of the enclosingexpr::Expr.