26c83f24cf6e29aada6ea5112db6d71c7f332b49 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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: "x"
  26. type {
  27. auto_pattern {
  28. }
  29. }
  30. }
  31. }
  32. init {
  33. struct_literal {
  34. fields {
  35. name: "x"
  36. expression {
  37. int_literal {
  38. value: 0
  39. }
  40. }
  41. }
  42. fields {
  43. name: "y"
  44. expression {
  45. int_literal {
  46. value: 1
  47. }
  48. }
  49. }
  50. }
  51. }
  52. is_returned: false
  53. }
  54. }
  55. statements {
  56. assign {
  57. lhs {
  58. identifier {
  59. name: "x"
  60. }
  61. }
  62. rhs {
  63. struct_literal {
  64. fields {
  65. name: "x"
  66. expression {
  67. int_literal {
  68. value: 5
  69. }
  70. }
  71. }
  72. fields {
  73. name: "y"
  74. expression {
  75. operator {
  76. op: Neg
  77. arguments {
  78. int_literal {
  79. value: 5
  80. }
  81. }
  82. }
  83. }
  84. }
  85. }
  86. }
  87. op: Plain
  88. }
  89. }
  90. statements {
  91. return_expression_statement {
  92. expression {
  93. operator {
  94. op: Add
  95. arguments {
  96. simple_member_access {
  97. field: "x"
  98. object {
  99. identifier {
  100. name: "x"
  101. }
  102. }
  103. }
  104. }
  105. arguments {
  106. simple_member_access {
  107. field: "y"
  108. object {
  109. identifier {
  110. name: "x"
  111. }
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }
  120. }
  121. }
  122. }