summaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2013-05-14 16:09:10 +0100
committerStephen Dolan <mu@netsoc.tcd.ie>2013-05-14 16:09:10 +0100
commit81be37b23601a948164f0eb4a4f0331fa83ccf15 (patch)
tree2b606e494caf6dff94405481a1e3a3557684d821 /builtin.c
parent4d540b7102cb3a63ea5b966b1bbe42ad275fbf25 (diff)
Add the range function
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin.c b/builtin.c
index 2a48ba35..09ef9fcd 100644
--- a/builtin.c
+++ b/builtin.c
@@ -530,6 +530,18 @@ static block bind_bytecoded_builtins(block b) {
builtin_def_1arg[i].code));
}
}
+ {
+ block rangevar = block_bind(gen_op_var_unbound(STOREV, "rangevar"),
+ gen_noop(), OP_HAS_VARIABLE);
+ block init = BLOCK(gen_op_simple(DUP), gen_call("start", gen_noop()), rangevar);
+ block range = BLOCK(init,
+ gen_call("end", gen_noop()),
+ gen_op_var_bound(RANGE, rangevar));
+ builtins = BLOCK(builtins, gen_function("range",
+ BLOCK(gen_op_block_unbound(CLOSURE_PARAM, "start"),
+ gen_op_block_unbound(CLOSURE_PARAM, "end")),
+ range));
+ }
return block_bind(builtins, b, OP_IS_CALL_PSEUDO);
}