Explorer

core.value-to-part-content

description
Read a value of the evaluator (core.value) as core.part-content. none if the shape differs (generated by scripts/generate_value_decoders.ts)
type
Fn(value: @core.value) -> Union{#none, #some(@core.part-content)}
expression
fn(value$0) =>
  match $0 {
    #record(fields$1) =>
      match @core.value-record-field(fields: $1, key: "description", index: 0) {
        #some(field$2) =>
          match @core.value-decoded(
              T: List<@core.localized-text>,
              decoded: match $2 {
                #list(items$4) =>
                  @core.value-to-list(
                    T: @core.localized-text,
                    items: $4,
                    decode: fn(value$5) =>
                      @core.value-to-localized-text(value: $5),
                    index: 0,
                    acc: []
                  ),
                _ =>
                  #none
              }
            ) {
            #some(description$3) =>
              match @core.value-record-field(fields: $1, key: "visibility", index: 0) {
                #some(field$6) =>
                  match @core.value-to-visibility(value: $6) {
                    #some(visibility$7) =>
                      match @core.value-record-field(fields: $1, key: "part_type", index: 0) {
                        #some(field$8) =>
                          match @core.value-decoded(
                              T: Union{#none, #some(@core.expression)},
                              decoded: match $8 {
                                #variant(variant$10) =>
                                  match $10.tag {
                                    "none" =>
                                      #some(#none),
                                    "some" =>
                                      match @core.value-to-expression(value: $10.payload) {
                                        #some(payload$11) =>
                                          #some(#some($11)),
                                        _ =>
                                          #none
                                      },
                                    _ =>
                                      #none
                                  },
                                _ =>
                                  #none
                              }
                            ) {
                            #some(part_type$9) =>
                              match @core.value-record-field(fields: $1, key: "expression", index: 0) {
                                #some(field$12) =>
                                  match @core.value-decoded(
                                      T: Union{#none, #some(@core.expression)},
                                      decoded: match $12 {
                                        #variant(variant$14) =>
                                          match $14.tag {
                                            "none" =>
                                              #some(#none),
                                            "some" =>
                                              match @core.value-to-expression(value: $14.payload) {
                                                #some(payload$15) =>
                                                  #some(#some($15)),
                                                _ =>
                                                  #none
                                              },
                                            _ =>
                                              #none
                                          },
                                        _ =>
                                          #none
                                      }
                                    ) {
                                    #some(expression$13) =>
                                      #some({description: $3, visibility: $7, part_type: $9, expression: $13}),
                                    _ =>
                                      #none
                                  },
                                _ =>
                                  #none
                              },
                            _ =>
                              #none
                          },
                        _ =>
                          #none
                      },
                    _ =>
                      #none
                  },
                _ =>
                  #none
              },
            _ =>
              #none
          },
        _ =>
          #none
      },
    _ =>
      #none
  }
visibility
public
core.value-to-part-content (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: uXyzJC-nKCRqvOAGEWJIE4oMc6sI6to6IXXVdvVtK4Q
content hash: rwK4QMVVf2kIpBQdGKTTUcZqX1_CviPGhC6zyaqvL_k