compilation_unit {
  package_statement {
    package_name: "ExplorerTest"
  }
  is_api: true
  declarations {
    class_declaration {
      name {
        name: "ListElement"
      }
      members {
        function {
          name {
            name: "Create"
          }
          param_pattern {
            fields {
              binding_pattern {
                name: "value"
                type {
                  expression_pattern {
                    expression {
                      int_type_literal {
                      }
                    }
                  }
                }
              }
            }
          }
          return_term {
            kind: Expression
            type {
              identifier {
                name: "ListElement"
              }
            }
          }
          body {
            statements {
              return_expression_statement {
                expression {
                  struct_literal {
                    fields {
                      name: "element"
                      expression {
                        call {
                          function {
                            simple_member_access {
                              field: "Create"
                              object {
                                call {
                                  function {
                                    identifier {
                                      name: "Optional"
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                      fields {
                                        int_type_literal {
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                          argument {
                            tuple_literal {
                              fields {
                                identifier {
                                  name: "value"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                    fields {
                      name: "next"
                      expression {
                        call {
                          function {
                            simple_member_access {
                              field: "CreateEmpty"
                              object {
                                call {
                                  function {
                                    identifier {
                                      name: "Optional"
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                      fields {
                                        operator {
                                          op: Ptr
                                          arguments {
                                            identifier {
                                              name: "ListElement"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                          argument {
                            tuple_literal {
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      members {
        function {
          name {
            name: "set"
          }
          self_pattern {
            addr_pattern {
              binding_pattern {
                name: "self"
                type {
                  expression_pattern {
                    expression {
                      operator {
                        op: Ptr
                        arguments {
                          identifier {
                            name: "Self"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          param_pattern {
            fields {
              binding_pattern {
                name: "value"
                type {
                  expression_pattern {
                    expression {
                      call {
                        function {
                          identifier {
                            name: "Optional"
                          }
                        }
                        argument {
                          tuple_literal {
                            fields {
                              operator {
                                op: Ptr
                                arguments {
                                  identifier {
                                    name: "ListElement"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          return_term {
            kind: Omitted
          }
          body {
            statements {
              assign {
                lhs {
                  simple_member_access {
                    field: "next"
                    object {
                      operator {
                        op: Deref
                        arguments {
                          identifier {
                            name: "self"
                          }
                        }
                      }
                    }
                  }
                }
                rhs {
                  identifier {
                    name: "value"
                  }
                }
                op: Plain
              }
            }
          }
        }
      }
      members {
        variable {
          binding {
            name: "element"
            type {
              expression_pattern {
                expression {
                  call {
                    function {
                      identifier {
                        name: "Optional"
                      }
                    }
                    argument {
                      tuple_literal {
                        fields {
                          int_type_literal {
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      members {
        variable {
          binding {
            name: "next"
            type {
              expression_pattern {
                expression {
                  call {
                    function {
                      identifier {
                        name: "Optional"
                      }
                    }
                    argument {
                      tuple_literal {
                        fields {
                          operator {
                            op: Ptr
                            arguments {
                              identifier {
                                name: "ListElement"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  declarations {
    class_declaration {
      name {
        name: "List"
      }
      members {
        function {
          name {
            name: "Create"
          }
          param_pattern {
          }
          return_term {
            kind: Expression
            type {
              identifier {
                name: "List"
              }
            }
          }
          body {
            statements {
              return_expression_statement {
                expression {
                  struct_literal {
                    fields {
                      name: "next"
                      expression {
                        call {
                          function {
                            simple_member_access {
                              field: "CreateEmpty"
                              object {
                                call {
                                  function {
                                    identifier {
                                      name: "Optional"
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                      fields {
                                        operator {
                                          op: Ptr
                                          arguments {
                                            identifier {
                                              name: "ListElement"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                          argument {
                            tuple_literal {
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      members {
        function {
          name {
            name: "insert"
          }
          self_pattern {
            addr_pattern {
              binding_pattern {
                name: "self"
                type {
                  expression_pattern {
                    expression {
                      operator {
                        op: Ptr
                        arguments {
                          identifier {
                            name: "Self"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          param_pattern {
            fields {
              binding_pattern {
                name: "value"
                type {
                  expression_pattern {
                    expression {
                      int_type_literal {
                      }
                    }
                  }
                }
              }
            }
          }
          return_term {
            kind: Omitted
          }
          body {
            statements {
              if_statement {
                condition {
                  operator {
                    op: Not
                    arguments {
                      call {
                        function {
                          simple_member_access {
                            field: "HasValue"
                            object {
                              simple_member_access {
                                field: "next"
                                object {
                                  operator {
                                    op: Deref
                                    arguments {
                                      identifier {
                                        name: "self"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                        argument {
                          tuple_literal {
                          }
                        }
                      }
                    }
                  }
                }
                then_block {
                  statements {
                    assign {
                      lhs {
                        simple_member_access {
                          field: "next"
                          object {
                            operator {
                              op: Deref
                              arguments {
                                identifier {
                                  name: "self"
                                }
                              }
                            }
                          }
                        }
                      }
                      rhs {
                        call {
                          function {
                            simple_member_access {
                              field: "Create"
                              object {
                                call {
                                  function {
                                    identifier {
                                      name: "Optional"
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                      fields {
                                        operator {
                                          op: Ptr
                                          arguments {
                                            identifier {
                                              name: "ListElement"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                          argument {
                            tuple_literal {
                              fields {
                                call {
                                  function {
                                    simple_member_access {
                                      field: "New"
                                      object {
                                        identifier {
                                          name: "heap"
                                        }
                                      }
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                      fields {
                                        call {
                                          function {
                                            simple_member_access {
                                              field: "Create"
                                              object {
                                                identifier {
                                                  name: "ListElement"
                                                }
                                              }
                                            }
                                          }
                                          argument {
                                            tuple_literal {
                                              fields {
                                                identifier {
                                                  name: "value"
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                      op: Plain
                    }
                  }
                  statements {
                    return_expression_statement {
                      is_omitted_expression: true
                    }
                  }
                }
              }
            }
            statements {
              variable_definition {
                pattern {
                  binding_pattern {
                    name: "iter"
                    type {
                      expression_pattern {
                        expression {
                          call {
                            function {
                              identifier {
                                name: "Optional"
                              }
                            }
                            argument {
                              tuple_literal {
                                fields {
                                  operator {
                                    op: Ptr
                                    arguments {
                                      identifier {
                                        name: "ListElement"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
                init {
                  simple_member_access {
                    field: "next"
                    object {
                      operator {
                        op: Deref
                        arguments {
                          identifier {
                            name: "self"
                          }
                        }
                      }
                    }
                  }
                }
                is_returned: false
              }
            }
            statements {
              variable_definition {
                pattern {
                  binding_pattern {
                    name: "node"
                    type {
                      auto_pattern {
                      }
                    }
                  }
                }
                init {
                  call {
                    function {
                      simple_member_access {
                        field: "Get"
                        object {
                          identifier {
                            name: "iter"
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                      }
                    }
                  }
                }
                is_returned: false
              }
            }
            statements {
              while_statement {
                condition {
                  call {
                    function {
                      simple_member_access {
                        field: "HasValue"
                        object {
                          simple_member_access {
                            field: "next"
                            object {
                              operator {
                                op: Deref
                                arguments {
                                  identifier {
                                    name: "node"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                      }
                    }
                  }
                }
                body {
                  statements {
                    assign {
                      lhs {
                        identifier {
                          name: "iter"
                        }
                      }
                      rhs {
                        simple_member_access {
                          field: "next"
                          object {
                            operator {
                              op: Deref
                              arguments {
                                identifier {
                                  name: "node"
                                }
                              }
                            }
                          }
                        }
                      }
                      op: Plain
                    }
                  }
                  statements {
                    assign {
                      lhs {
                        identifier {
                          name: "node"
                        }
                      }
                      rhs {
                        call {
                          function {
                            simple_member_access {
                              field: "Get"
                              object {
                                identifier {
                                  name: "iter"
                                }
                              }
                            }
                          }
                          argument {
                            tuple_literal {
                            }
                          }
                        }
                      }
                      op: Plain
                    }
                  }
                }
              }
            }
            statements {
              variable_definition {
                pattern {
                  binding_pattern {
                    name: "v"
                    type {
                      expression_pattern {
                        expression {
                          operator {
                            op: Ptr
                            arguments {
                              identifier {
                                name: "ListElement"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
                init {
                  call {
                    function {
                      simple_member_access {
                        field: "Get"
                        object {
                          identifier {
                            name: "iter"
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                      }
                    }
                  }
                }
                is_returned: false
              }
            }
            statements {
              variable_definition {
                pattern {
                  binding_pattern {
                    name: "x"
                    type {
                      expression_pattern {
                        expression {
                          call {
                            function {
                              identifier {
                                name: "Optional"
                              }
                            }
                            argument {
                              tuple_literal {
                                fields {
                                  operator {
                                    op: Ptr
                                    arguments {
                                      identifier {
                                        name: "ListElement"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
                init {
                  call {
                    function {
                      simple_member_access {
                        field: "Create"
                        object {
                          call {
                            function {
                              identifier {
                                name: "Optional"
                              }
                            }
                            argument {
                              tuple_literal {
                                fields {
                                  operator {
                                    op: Ptr
                                    arguments {
                                      identifier {
                                        name: "ListElement"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                        fields {
                          call {
                            function {
                              simple_member_access {
                                field: "New"
                                object {
                                  identifier {
                                    name: "heap"
                                  }
                                }
                              }
                            }
                            argument {
                              tuple_literal {
                                fields {
                                  call {
                                    function {
                                      simple_member_access {
                                        field: "Create"
                                        object {
                                          identifier {
                                            name: "ListElement"
                                          }
                                        }
                                      }
                                    }
                                    argument {
                                      tuple_literal {
                                        fields {
                                          identifier {
                                            name: "value"
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
                is_returned: false
              }
            }
            statements {
              expression_statement {
                expression {
                  call {
                    function {
                      simple_member_access {
                        field: "set"
                        object {
                          operator {
                            op: Deref
                            arguments {
                              identifier {
                                name: "v"
                              }
                            }
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                        fields {
                          identifier {
                            name: "x"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      members {
        function {
          name {
            name: "print"
          }
          self_pattern {
            binding_pattern {
              name: "self"
              type {
                expression_pattern {
                  expression {
                    identifier {
                      name: "Self"
                    }
                  }
                }
              }
            }
          }
          param_pattern {
          }
          return_term {
            kind: Omitted
          }
          body {
            statements {
              variable_definition {
                pattern {
                  binding_pattern {
                    name: "iter"
                    type {
                      expression_pattern {
                        expression {
                          call {
                            function {
                              identifier {
                                name: "Optional"
                              }
                            }
                            argument {
                              tuple_literal {
                                fields {
                                  operator {
                                    op: Ptr
                                    arguments {
                                      identifier {
                                        name: "ListElement"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
                init {
                  simple_member_access {
                    field: "next"
                    object {
                      identifier {
                        name: "self"
                      }
                    }
                  }
                }
                is_returned: false
              }
            }
            statements {
              while_statement {
                condition {
                  call {
                    function {
                      simple_member_access {
                        field: "HasValue"
                        object {
                          identifier {
                            name: "iter"
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                      }
                    }
                  }
                }
                body {
                  statements {
                    variable_definition {
                      pattern {
                        binding_pattern {
                          name: "node"
                          type {
                            auto_pattern {
                            }
                          }
                        }
                      }
                      init {
                        operator {
                          op: Deref
                          arguments {
                            call {
                              function {
                                simple_member_access {
                                  field: "Get"
                                  object {
                                    identifier {
                                      name: "iter"
                                    }
                                  }
                                }
                              }
                              argument {
                                tuple_literal {
                                }
                              }
                            }
                          }
                        }
                      }
                      is_returned: false
                    }
                  }
                  statements {
                    expression_statement {
                      expression {
                        call {
                          function {
                            identifier {
                              name: "Print"
                            }
                          }
                          argument {
                            tuple_literal {
                              fields {
                                string_literal {
                                  value: "{0}"
                                }
                              }
                              fields {
                                call {
                                  function {
                                    simple_member_access {
                                      field: "Get"
                                      object {
                                        simple_member_access {
                                          field: "element"
                                          object {
                                            identifier {
                                              name: "node"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                  statements {
                    variable_definition {
                      pattern {
                        binding_pattern {
                          name: "node_ptr"
                          type {
                            auto_pattern {
                            }
                          }
                        }
                      }
                      init {
                        call {
                          function {
                            simple_member_access {
                              field: "Get"
                              object {
                                identifier {
                                  name: "iter"
                                }
                              }
                            }
                          }
                          argument {
                            tuple_literal {
                            }
                          }
                        }
                      }
                      is_returned: false
                    }
                  }
                  statements {
                    assign {
                      lhs {
                        identifier {
                          name: "iter"
                        }
                      }
                      rhs {
                        simple_member_access {
                          field: "next"
                          object {
                            identifier {
                              name: "node"
                            }
                          }
                        }
                      }
                      op: Plain
                    }
                  }
                }
              }
            }
          }
        }
      }
      members {
        function {
          name {
            name: "clean"
          }
          self_pattern {
            addr_pattern {
              binding_pattern {
                name: "self"
                type {
                  expression_pattern {
                    expression {
                      operator {
                        op: Ptr
                        arguments {
                          identifier {
                            name: "Self"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          param_pattern {
          }
          return_term {
            kind: Omitted
          }
          body {
            statements {
              variable_definition {
                pattern {
                  binding_pattern {
                    name: "head"
                    type {
                      auto_pattern {
                      }
                    }
                  }
                }
                init {
                  simple_member_access {
                    field: "next"
                    object {
                      operator {
                        op: Deref
                        arguments {
                          identifier {
                            name: "self"
                          }
                        }
                      }
                    }
                  }
                }
                is_returned: false
              }
            }
            statements {
              while_statement {
                condition {
                  call {
                    function {
                      simple_member_access {
                        field: "HasValue"
                        object {
                          identifier {
                            name: "head"
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                      }
                    }
                  }
                }
                body {
                  statements {
                    variable_definition {
                      pattern {
                        binding_pattern {
                          name: "tmp"
                          type {
                            auto_pattern {
                            }
                          }
                        }
                      }
                      init {
                        identifier {
                          name: "head"
                        }
                      }
                      is_returned: false
                    }
                  }
                  statements {
                    assign {
                      lhs {
                        identifier {
                          name: "head"
                        }
                      }
                      rhs {
                        simple_member_access {
                          field: "next"
                          object {
                            operator {
                              op: Deref
                              arguments {
                                call {
                                  function {
                                    simple_member_access {
                                      field: "Get"
                                      object {
                                        identifier {
                                          name: "head"
                                        }
                                      }
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                      op: Plain
                    }
                  }
                  statements {
                    expression_statement {
                      expression {
                        call {
                          function {
                            simple_member_access {
                              field: "Delete"
                              object {
                                identifier {
                                  name: "heap"
                                }
                              }
                            }
                          }
                          argument {
                            tuple_literal {
                              fields {
                                call {
                                  function {
                                    simple_member_access {
                                      field: "Get"
                                      object {
                                        identifier {
                                          name: "tmp"
                                        }
                                      }
                                    }
                                  }
                                  argument {
                                    tuple_literal {
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
            statements {
              assign {
                lhs {
                  simple_member_access {
                    field: "next"
                    object {
                      operator {
                        op: Deref
                        arguments {
                          identifier {
                            name: "self"
                          }
                        }
                      }
                    }
                  }
                }
                rhs {
                  call {
                    function {
                      simple_member_access {
                        field: "CreateEmpty"
                        object {
                          call {
                            function {
                              identifier {
                                name: "Optional"
                              }
                            }
                            argument {
                              tuple_literal {
                                fields {
                                  operator {
                                    op: Ptr
                                    arguments {
                                      identifier {
                                        name: "ListElement"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                    argument {
                      tuple_literal {
                      }
                    }
                  }
                }
                op: Plain
              }
            }
          }
        }
      }
      members {
        variable {
          binding {
            name: "next"
            type {
              expression_pattern {
                expression {
                  call {
                    function {
                      identifier {
                        name: "Optional"
                      }
                    }
                    argument {
                      tuple_literal {
                        fields {
                          operator {
                            op: Ptr
                            arguments {
                              identifier {
                                name: "ListElement"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  declarations {
    function {
      name {
        name: "Main"
      }
      param_pattern {
      }
      return_term {
        kind: Expression
        type {
          int_type_literal {
          }
        }
      }
      body {
        statements {
          variable_definition {
            pattern {
              binding_pattern {
                name: "list"
                type {
                  expression_pattern {
                    expression {
                      identifier {
                        name: "List"
                      }
                    }
                  }
                }
              }
            }
            init {
              call {
                function {
                  simple_member_access {
                    field: "Create"
                    object {
                      identifier {
                        name: "List"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                  }
                }
              }
            }
            is_returned: false
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 1
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 2
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 3
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 4
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "print"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "clean"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "print"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 1
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 2
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 3
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "insert"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                    fields {
                      int_literal {
                        value: 4
                      }
                    }
                  }
                }
              }
            }
          }
        }
        statements {
          expression_statement {
            expression {
              call {
                function {
                  simple_member_access {
                    field: "print"
                    object {
                      identifier {
                        name: "list"
                      }
                    }
                  }
                }
                argument {
                  tuple_literal {
                  }
                }
              }
            }
          }
        }
        statements {
          return_expression_statement {
            expression {
              int_literal {
                value: 0
              }
            }
          }
        }
      }
    }
  }
}
