a3e7fdd6333766ddcf6e0ea91314908660d30ffb 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. choice {
  8. name {
  9. name: "MyOptionalElement"
  10. }
  11. alternatives {
  12. name: "None"
  13. signature {
  14. fields {
  15. identifier {
  16. name: "ZZ"
  17. }
  18. }
  19. }
  20. }
  21. alternatives {
  22. name: "Element"
  23. signature {
  24. fields {
  25. identifier {
  26. name: "ZZ"
  27. }
  28. }
  29. }
  30. }
  31. }
  32. }
  33. declarations {
  34. function {
  35. name {
  36. name: "Main"
  37. }
  38. param_pattern {
  39. }
  40. return_term {
  41. kind: Expression
  42. type {
  43. int_type_literal {
  44. }
  45. }
  46. }
  47. body {
  48. statements {
  49. variable_definition {
  50. pattern {
  51. binding_pattern {
  52. name: "f"
  53. type {
  54. expression_pattern {
  55. expression {
  56. call {
  57. function {
  58. identifier {
  59. name: "MyOptionalElement"
  60. }
  61. }
  62. argument {
  63. tuple_literal {
  64. fields {
  65. int_type_literal {
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. is_returned: false
  77. }
  78. }
  79. statements {
  80. assign {
  81. lhs {
  82. identifier {
  83. name: "f"
  84. }
  85. }
  86. rhs {
  87. call {
  88. function {
  89. simple_member_access {
  90. field: "None"
  91. object {
  92. call {
  93. function {
  94. identifier {
  95. name: "MyOptionalElement"
  96. }
  97. }
  98. argument {
  99. tuple_literal {
  100. fields {
  101. int_type_literal {
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
  109. }
  110. argument {
  111. tuple_literal {
  112. fields {
  113. int_literal {
  114. value: 22
  115. }
  116. }
  117. }
  118. }
  119. }
  120. }
  121. op: Plain
  122. }
  123. }
  124. statements {
  125. match {
  126. expression {
  127. identifier {
  128. name: "f"
  129. }
  130. }
  131. clauses {
  132. pattern {
  133. alternative_pattern {
  134. choice_type {
  135. call {
  136. function {
  137. identifier {
  138. name: "MyOptionalElement"
  139. }
  140. }
  141. argument {
  142. tuple_literal {
  143. fields {
  144. int_type_literal {
  145. }
  146. }
  147. }
  148. }
  149. }
  150. }
  151. alternative_name: "None"
  152. arguments {
  153. fields {
  154. var_pattern {
  155. pattern {
  156. binding_pattern {
  157. name: "x"
  158. type {
  159. expression_pattern {
  160. expression {
  161. int_type_literal {
  162. }
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. }
  173. statement {
  174. block {
  175. statements {
  176. return_expression_statement {
  177. expression {
  178. identifier {
  179. name: "x"
  180. }
  181. }
  182. }
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. statements {
  190. return_expression_statement {
  191. expression {
  192. int_literal {
  193. value: 0
  194. }
  195. }
  196. }
  197. }
  198. }
  199. }
  200. }
  201. }