5e1b0ea6622640145c4876931e297c5edb8231d8 2.9 KB

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