Explorer

core.module-snapshot-classify

description
Decide which parts in the snapshot to check: unchanged parts are skipped unless they are affected by a type change, and parts without an expression or a type are listed separately
type
Fn(
  previous: List<List<Record{
    part_id: String,
    module_id: String,
    part_type: Union{#none, #some(@core.expression)},
    type_declaration: Union{#none, #some(@core.expression)},
    expression_key: Union{#none, #some(String)},
    has_expression: Boolean,
    references: List<String>
  }>>,
  committed: List<Record{
    part_id: String,
    module_id: String,
    part_type: Union{#none, #some(@core.expression)},
    type_declaration: Union{#none, #some(@core.expression)},
    expression_key: Union{#none, #some(String)},
    has_expression: Boolean,
    references: List<String>
  }>,
  affected: List<List<Record{key: String}>>,
  index: Number,
  to_check: List<String>,
  without_expression: List<String>
) -> Record{to_check: List<String>, without_expression: List<String>}
expression
fn(previous$0, committed$1, affected$2, index$3, to_check$4, without_expression$5) =>
  match @core.list-get(list: $1, index: $3) {
    #none(_) =>
      {to_check: $4, without_expression: $5},
    #some(entry$6) =>
      let unchanged$7 = match @core.module-entry-lookup(entries: $0, part_id: $6.part_id) {
          #none(_) =>
            false,
          #some(before$8) =>
            @core.option-string-equals(a: $8.expression_key, b: $6.expression_key)
        };
      match $7 {
        true =>
          match @core.string-set-has(set: $2, value: $6.part_id) {
            true =>
              match $6.part_type {
                #none(_) =>
                  @core.module-snapshot-classify(
                    previous: $0,
                    committed: $1,
                    affected: $2,
                    index: @core.plus(left: $3, right: 1),
                    to_check: $4,
                    without_expression: @core.list-append(list: $5, item: $6.part_id)
                  ),
                #some(_) =>
                  match $6.has_expression {
                    true =>
                      @core.module-snapshot-classify(
                        previous: $0,
                        committed: $1,
                        affected: $2,
                        index: @core.plus(left: $3, right: 1),
                        to_check: @core.list-append(list: $4, item: $6.part_id),
                        without_expression: $5
                      ),
                    false =>
                      @core.module-snapshot-classify(
                        previous: $0,
                        committed: $1,
                        affected: $2,
                        index: @core.plus(left: $3, right: 1),
                        to_check: $4,
                        without_expression: @core.list-append(list: $5, item: $6.part_id)
                      )
                  }
              },
            false =>
              @core.module-snapshot-classify(
                previous: $0,
                committed: $1,
                affected: $2,
                index: @core.plus(left: $3, right: 1),
                to_check: $4,
                without_expression: $5
              )
          },
        false =>
          match $6.part_type {
            #none(_) =>
              @core.module-snapshot-classify(
                previous: $0,
                committed: $1,
                affected: $2,
                index: @core.plus(left: $3, right: 1),
                to_check: $4,
                without_expression: @core.list-append(list: $5, item: $6.part_id)
              ),
            #some(_) =>
              match $6.has_expression {
                true =>
                  @core.module-snapshot-classify(
                    previous: $0,
                    committed: $1,
                    affected: $2,
                    index: @core.plus(left: $3, right: 1),
                    to_check: @core.list-append(list: $4, item: $6.part_id),
                    without_expression: $5
                  ),
                false =>
                  @core.module-snapshot-classify(
                    previous: $0,
                    committed: $1,
                    affected: $2,
                    index: @core.plus(left: $3, right: 1),
                    to_check: $4,
                    without_expression: @core.list-append(list: $5, item: $6.part_id)
                  )
              }
          }
      }
  }
visibility
public
core.module-snapshot-classify (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: s1VL08z4MEhM7VCw0ri6qtTQKWW50iW3ennqWp_unkE
content hash: L98tNrySm1K8xzSz76EW3qpzkw69wo4XhS7-MS8lHFo