Explorer

core.eval-part-reference

description
Find the part with the given id in parts and evaluate its expression in an empty environment (unit when not found)
type
Fn(parts: List<Record{id: String, expression: @core.expression}>, id: String, index: Number) -> @core.value
expression
fn(parts$0, id$1, index$2) =>
  match @core.list-get(list: $0, index: $2) {
    #none(_) =>
      #unit,
    #some(item$1004) =>
      let part$3 = $1004;
      match @core.equal(left: $3.id, right: $1) {
        true =>
          match @core.is-type-expression(expr: $3.expression) {
            true =>
              @core.eval-value(
                expr: @core.type-expression-construct(expr: #part_reference<@core.expression>({part_definition_event_hash: $1})),
                env: [],
                parts: $0
              ),
            false =>
              @core.eval-value(expr: $3.expression, env: [], parts: $0)
          },
        false =>
          @core.eval-part-reference(parts: $0, id: $1, index: @core.plus(left: $2, right: 1))
      }
  }
visibility
public
core.eval-part-reference (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: UWbIf-ypiD19uUE52PKuCAE7wBEUS-Dbs1zD5tYjzt8
content hash: MuYQ8CLVNOgv0-BN06UQQxQasJVFvFr0n15ox23F6Zk