aabfa1065ebe0a671c2a78961b101a1d45ab0acd 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. compilation_unit {
  2. package_statement {
  3. package_name: "ExplorerTest"
  4. }
  5. is_api: true
  6. declarations {
  7. class_declaration {
  8. name {
  9. name: "A"
  10. }
  11. members {
  12. variable {
  13. binding {
  14. name: "n"
  15. type {
  16. expression_pattern {
  17. expression {
  18. int_type_literal {
  19. }
  20. }
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. declarations {
  29. impl {
  30. kind: ExternalImpl
  31. impl_type {
  32. identifier {
  33. name: "A"
  34. }
  35. }
  36. interface {
  37. where {
  38. base {
  39. call {
  40. function {
  41. identifier {
  42. name: "BitAndWith"
  43. }
  44. }
  45. argument {
  46. tuple_literal {
  47. fields {
  48. int_type_literal {
  49. }
  50. }
  51. }
  52. }
  53. }
  54. }
  55. clauses {
  56. rewrite {
  57. member_name: "Result"
  58. replacement {
  59. identifier {
  60. name: "A"
  61. }
  62. }
  63. }
  64. }
  65. }
  66. }
  67. members {
  68. function {
  69. name {
  70. name: "Op"
  71. }
  72. self_pattern {
  73. binding_pattern {
  74. name: "self"
  75. type {
  76. expression_pattern {
  77. expression {
  78. identifier {
  79. name: "Self"
  80. }
  81. }
  82. }
  83. }
  84. }
  85. }
  86. param_pattern {
  87. fields {
  88. binding_pattern {
  89. name: "rhs"
  90. type {
  91. expression_pattern {
  92. expression {
  93. int_type_literal {
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. return_term {
  102. kind: Expression
  103. type {
  104. identifier {
  105. name: "A"
  106. }
  107. }
  108. }
  109. body {
  110. statements {
  111. return_expression_statement {
  112. expression {
  113. struct_literal {
  114. fields {
  115. name: "n"
  116. expression {
  117. operator {
  118. op: BitwiseAnd
  119. arguments {
  120. simple_member_access {
  121. field: "n"
  122. object {
  123. identifier {
  124. name: "self"
  125. }
  126. }
  127. }
  128. }
  129. arguments {
  130. identifier {
  131. name: "rhs"
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. declarations {
  147. function {
  148. name {
  149. name: "Main"
  150. }
  151. param_pattern {
  152. }
  153. return_term {
  154. kind: Expression
  155. type {
  156. int_type_literal {
  157. }
  158. }
  159. }
  160. body {
  161. statements {
  162. variable_definition {
  163. pattern {
  164. binding_pattern {
  165. name: "a"
  166. type {
  167. expression_pattern {
  168. expression {
  169. identifier {
  170. name: "A"
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. init {
  178. struct_literal {
  179. fields {
  180. name: "n"
  181. expression {
  182. int_literal {
  183. value: 13
  184. }
  185. }
  186. }
  187. }
  188. }
  189. is_returned: false
  190. }
  191. }
  192. statements {
  193. assign {
  194. lhs {
  195. identifier {
  196. name: "a"
  197. }
  198. }
  199. rhs {
  200. operator {
  201. op: BitwiseAnd
  202. arguments {
  203. identifier {
  204. name: "a"
  205. }
  206. }
  207. arguments {
  208. int_literal {
  209. value: 7
  210. }
  211. }
  212. }
  213. }
  214. op: Plain
  215. }
  216. }
  217. statements {
  218. expression_statement {
  219. expression {
  220. call {
  221. function {
  222. identifier {
  223. name: "Print"
  224. }
  225. }
  226. argument {
  227. tuple_literal {
  228. fields {
  229. string_literal {
  230. value: "{0}"
  231. }
  232. }
  233. fields {
  234. simple_member_access {
  235. field: "n"
  236. object {
  237. identifier {
  238. name: "a"
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. }
  248. }
  249. statements {
  250. assign {
  251. lhs {
  252. identifier {
  253. name: "a"
  254. }
  255. }
  256. rhs {
  257. operator {
  258. op: Neg
  259. arguments {
  260. int_literal {
  261. value: 2
  262. }
  263. }
  264. }
  265. }
  266. op: And
  267. }
  268. }
  269. statements {
  270. expression_statement {
  271. expression {
  272. call {
  273. function {
  274. identifier {
  275. name: "Print"
  276. }
  277. }
  278. argument {
  279. tuple_literal {
  280. fields {
  281. string_literal {
  282. value: "{0}"
  283. }
  284. }
  285. fields {
  286. simple_member_access {
  287. field: "n"
  288. object {
  289. identifier {
  290. name: "a"
  291. }
  292. }
  293. }
  294. }
  295. }
  296. }
  297. }
  298. }
  299. }
  300. }
  301. statements {
  302. expression_statement {
  303. expression {
  304. call {
  305. function {
  306. identifier {
  307. name: "Print"
  308. }
  309. }
  310. argument {
  311. tuple_literal {
  312. fields {
  313. string_literal {
  314. value: "{0}"
  315. }
  316. }
  317. fields {
  318. simple_member_access {
  319. field: "n"
  320. object {
  321. operator {
  322. op: BitwiseAnd
  323. arguments {
  324. identifier {
  325. name: "a"
  326. }
  327. }
  328. arguments {
  329. int_literal {
  330. value: 3
  331. }
  332. }
  333. }
  334. }
  335. }
  336. }
  337. }
  338. }
  339. }
  340. }
  341. }
  342. }
  343. statements {
  344. return_expression_statement {
  345. expression {
  346. int_literal {
  347. value: 0
  348. }
  349. }
  350. }
  351. }
  352. }
  353. }
  354. }
  355. }