Explorer

core.compile-captures-range

description
Instructions that push the captured variables lo..hi (local.get, or ref.null when not bound) for array.new_fixed
type
Fn(
  variables: List<Number>,
  lo: Number,
  hi: Number,
  env: List<Record{variable_id: Number, local: Number}>,
  env_local: Number
) -> List<Number>
expression
fn(variables$0, lo$1, hi$5, env$2, env_local$3) =>
  match @core.less-than-or-equal(left: @core.minus(left: $5, right: $1), right: 1) {
    true =>
      match @core.less-than(left: $1, right: $5) {
        true =>
          match @core.list-get(list: $0, index: $1) {
            #none(_) =>
              [],
            #some(item$1007) =>
              let local$4 = @core.compile-env-lookup(env: $2, variable_id: $1007, index: 0);
              match @core.less-than(left: $4, right: 0) {
                true =>
                  [@wasm.ref-null, @core.wasm-type-value],
                false =>
                  @core.list-concat(left: [@wasm.local-get], right: @wasm.unsigned-leb128(n: $4))
              }
          },
        false =>
          []
      },
    false =>
      let mid$6 = @core.divide(left: @core.plus(left: $1, right: $5), right: 2);
      @core.list-concat(
        left: @core.compile-captures-range(variables: $0, lo: $1, hi: $6, env: $2, env_local: $3),
        right: @core.compile-captures-range(variables: $0, lo: $6, hi: $5, env: $2, env_local: $3)
      )
  }
visibility
public
core.compile-captures-range (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: IdcoXnmaWW-abLbAQl9y-gLtTyrYBT72ZL0FgR6lyUA
content hash: KdxwEGFwKLs98aQzXQUf4KNRK3bDo0ucwOIJtWFV9rM