17a00f823161d813cdcaa73fe8a860bfbfa1266c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. function {
  8. name {
  9. name: "IntDiff"
  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. if_statement {
  49. condition {
  50. operator {
  51. op: Eq
  52. arguments {
  53. identifier {
  54. name: "a"
  55. }
  56. }
  57. arguments {
  58. identifier {
  59. name: "b"
  60. }
  61. }
  62. }
  63. }
  64. then_block {
  65. statements {
  66. variable_definition {
  67. pattern {
  68. binding_pattern {
  69. name: "ret"
  70. type {
  71. expression_pattern {
  72. expression {
  73. int_type_literal {
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. init {
  81. operator {
  82. op: Sub
  83. arguments {
  84. identifier {
  85. name: "a"
  86. }
  87. }
  88. arguments {
  89. identifier {
  90. name: "b"
  91. }
  92. }
  93. }
  94. }
  95. is_returned: true
  96. }
  97. }
  98. statements {
  99. return_var_statement {
  100. }
  101. }
  102. }
  103. else_block {
  104. statements {
  105. variable_definition {
  106. pattern {
  107. binding_pattern {
  108. name: "ret2"
  109. type {
  110. expression_pattern {
  111. expression {
  112. int_type_literal {
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. init {
  120. operator {
  121. op: Sub
  122. arguments {
  123. identifier {
  124. name: "b"
  125. }
  126. }
  127. arguments {
  128. identifier {
  129. name: "a"
  130. }
  131. }
  132. }
  133. }
  134. is_returned: true
  135. }
  136. }
  137. statements {
  138. return_var_statement {
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. declarations {
  148. function {
  149. name {
  150. name: "Main"
  151. }
  152. param_pattern {
  153. }
  154. return_term {
  155. kind: Expression
  156. type {
  157. int_type_literal {
  158. }
  159. }
  160. }
  161. body {
  162. statements {
  163. return_expression_statement {
  164. expression {
  165. call {
  166. function {
  167. identifier {
  168. name: "IntDiff"
  169. }
  170. }
  171. argument {
  172. tuple_literal {
  173. fields {
  174. int_literal {
  175. value: 1
  176. }
  177. }
  178. fields {
  179. int_literal {
  180. value: 2
  181. }
  182. }
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }