4a2ff94c1916c48655f498955011a06fbcdf133e 4.2 KB

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