da4cda66ebb9c6633a08995da35a4ee374166704 6.6 KB

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