diff options
author | Stephen Dolan <mu@netsoc.tcd.ie> | 2013-05-14 16:09:10 +0100 |
---|---|---|
committer | Stephen Dolan <mu@netsoc.tcd.ie> | 2013-05-14 16:09:10 +0100 |
commit | 81be37b23601a948164f0eb4a4f0331fa83ccf15 (patch) | |
tree | 2b606e494caf6dff94405481a1e3a3557684d821 /builtin.c | |
parent | 4d540b7102cb3a63ea5b966b1bbe42ad275fbf25 (diff) |
Add the range function
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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); } |