11e091578ab1fee7bb92cf00355ff51be89cf801 4.1 KB

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