504ed50b0973afc1fdb432d2dd0798ae8705a997 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. function {
  8. name {
  9. name: "f"
  10. }
  11. param_pattern {
  12. fields {
  13. binding_pattern {
  14. name: "x"
  15. type {
  16. expression_pattern {
  17. expression {
  18. int_type_literal {
  19. }
  20. }
  21. }
  22. }
  23. }
  24. }
  25. }
  26. return_term {
  27. kind: Expression
  28. type {
  29. int_type_literal {
  30. }
  31. }
  32. }
  33. body {
  34. statements {
  35. if_statement {
  36. condition {
  37. operator {
  38. op: Eq
  39. arguments {
  40. identifier {
  41. name: "x"
  42. }
  43. }
  44. arguments {
  45. int_literal {
  46. value: 0
  47. }
  48. }
  49. }
  50. }
  51. then_block {
  52. statements {
  53. return_expression_statement {
  54. expression {
  55. identifier {
  56. name: "x"
  57. }
  58. }
  59. }
  60. }
  61. }
  62. else_block {
  63. statements {
  64. return_expression_statement {
  65. expression {
  66. call {
  67. function {
  68. identifier {
  69. name: "f"
  70. }
  71. }
  72. argument {
  73. tuple_literal {
  74. fields {
  75. operator {
  76. op: Sub
  77. arguments {
  78. identifier {
  79. name: "x"
  80. }
  81. }
  82. arguments {
  83. int_literal {
  84. value: 1
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. }
  93. }
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. declarations {
  102. function {
  103. name {
  104. name: "Main"
  105. }
  106. param_pattern {
  107. }
  108. return_term {
  109. kind: Expression
  110. type {
  111. int_type_literal {
  112. }
  113. }
  114. }
  115. body {
  116. statements {
  117. return_expression_statement {
  118. expression {
  119. call {
  120. function {
  121. identifier {
  122. name: "f"
  123. }
  124. }
  125. argument {
  126. tuple_literal {
  127. fields {
  128. int_literal {
  129. value: 2
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }