5b9b375c91986279a8a110f96835a50cbcc0260c 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. choice {
  8. name {
  9. name: "Opt"
  10. }
  11. alternatives {
  12. name: "None"
  13. signature {
  14. }
  15. }
  16. alternatives {
  17. name: "Some"
  18. signature {
  19. fields {
  20. int_type_literal {
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }
  27. declarations {
  28. function {
  29. name {
  30. name: "A"
  31. }
  32. param_pattern {
  33. fields {
  34. binding_pattern {
  35. name: "a"
  36. type {
  37. expression_pattern {
  38. expression {
  39. identifier {
  40. name: "Opt"
  41. }
  42. }
  43. }
  44. }
  45. }
  46. }
  47. fields {
  48. binding_pattern {
  49. name: "b"
  50. type {
  51. expression_pattern {
  52. expression {
  53. identifier {
  54. name: "Opt"
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. return_term {
  63. kind: Expression
  64. type {
  65. int_type_literal {
  66. }
  67. }
  68. }
  69. body {
  70. statements {
  71. match {
  72. expression {
  73. tuple_literal {
  74. fields {
  75. identifier {
  76. name: "a"
  77. }
  78. }
  79. fields {
  80. identifier {
  81. name: "b"
  82. }
  83. }
  84. }
  85. }
  86. clauses {
  87. pattern {
  88. tuple_pattern {
  89. fields {
  90. alternative_pattern {
  91. choice_type {
  92. identifier {
  93. name: "Opt"
  94. }
  95. }
  96. alternative_name: "Some"
  97. arguments {
  98. fields {
  99. binding_pattern {
  100. name: "n"
  101. type {
  102. expression_pattern {
  103. expression {
  104. int_type_literal {
  105. }
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. }
  113. }
  114. fields {
  115. binding_pattern {
  116. name: "_"
  117. type {
  118. auto_pattern {
  119. }
  120. }
  121. }
  122. }
  123. }
  124. }
  125. statement {
  126. block {
  127. statements {
  128. return_expression_statement {
  129. expression {
  130. identifier {
  131. name: "n"
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. clauses {
  140. pattern {
  141. tuple_pattern {
  142. fields {
  143. binding_pattern {
  144. name: "_"
  145. type {
  146. auto_pattern {
  147. }
  148. }
  149. }
  150. }
  151. fields {
  152. alternative_pattern {
  153. choice_type {
  154. identifier {
  155. name: "Opt"
  156. }
  157. }
  158. alternative_name: "Some"
  159. arguments {
  160. fields {
  161. binding_pattern {
  162. name: "n"
  163. type {
  164. expression_pattern {
  165. expression {
  166. int_type_literal {
  167. }
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. statement {
  179. block {
  180. statements {
  181. return_expression_statement {
  182. expression {
  183. identifier {
  184. name: "n"
  185. }
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. declarations {
  198. function {
  199. name {
  200. name: "Main"
  201. }
  202. param_pattern {
  203. }
  204. return_term {
  205. kind: Expression
  206. type {
  207. int_type_literal {
  208. }
  209. }
  210. }
  211. body {
  212. statements {
  213. return_expression_statement {
  214. expression {
  215. call {
  216. function {
  217. identifier {
  218. name: "A"
  219. }
  220. }
  221. argument {
  222. tuple_literal {
  223. fields {
  224. call {
  225. function {
  226. simple_member_access {
  227. field: "None"
  228. object {
  229. identifier {
  230. name: "Opt"
  231. }
  232. }
  233. }
  234. }
  235. argument {
  236. tuple_literal {
  237. }
  238. }
  239. }
  240. }
  241. fields {
  242. call {
  243. function {
  244. simple_member_access {
  245. field: "Some"
  246. object {
  247. identifier {
  248. name: "Opt"
  249. }
  250. }
  251. }
  252. }
  253. argument {
  254. tuple_literal {
  255. fields {
  256. int_literal {
  257. value: 1
  258. }
  259. }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }