Explorer

core.expression-part-references

description
Adds to ids the part IDs that the expression references (part_reference), also in type expressions and quotes. Each ID is added once
type
Fn(expr: @core.expression, ids: List<String>) -> List<String>
expression
fn(expr$0, ids$1) =>
  match $0 {
    #part_reference(reference$2) =>
      match @core.list-contains-string(list: $1, target: $2.part_definition_event_hash, index: 0) {
        true =>
          $1,
        false =>
          @core.list-append(list: $1, item: $2.part_definition_event_hash)
      },
    _ =>
      @core.expression-part-references-in-list(
        items: match $0 {
          #type_list(list_type$3) =>
            [$3.item_type],
          #type_code(list_type$3) =>
            [$3.value_type],
          #type_function(function_type$4) =>
            @core.list-append(
              list: @core.type-function-parameter-types(parameters: $4.parameters, index: 0),
              item: $4.return_type
            ),
          #type_record(fields$5) =>
            @core.record-item-values(items: $5, index: 0),
          #type_union(variants$6) =>
            @core.type-union-payload-types(variants: $6, index: 0),
          #quote(quoted$7) =>
            [$7],
          _ =>
            @core.expression-children(expr: $0)
        },
        index: 0,
        ids: $1
      )
  }
visibility
public
core.expression-part-references (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: tuaII7KOIpmrfIbS-wsycXyIJdiD-pmbYSUDX9GIpi4
content hash: yUVB5G1YRwvUP7UyYNd7OTjwEKdeZdoKipqDRQCaiSk