| ... | ... | @@ -1278,6 +1278,50 @@ fn walkInstruction( |
| 1278 | 1278 | .expr = .{ .binOpIndex = binop_index }, |
| 1279 | 1279 | }; |
| 1280 | 1280 | }, |
| 1281 | // compare operators |
| 1282 | .cmp_eq, |
| 1283 | .cmp_neq, |
| 1284 | .cmp_gt, |
| 1285 | .cmp_gte, |
| 1286 | .cmp_lt, |
| 1287 | .cmp_lte, |
| 1288 | => { |
| 1289 | const pl_node = data[inst_index].pl_node; |
| 1290 | const extra = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index); |
| 1291 | |
| 1292 | const binop_index = self.exprs.items.len; |
| 1293 | try self.exprs.append(self.arena, .{ .binOp = .{ .lhs = 0, .rhs = 0 } }); |
| 1294 | |
| 1295 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1296 | file, |
| 1297 | parent_scope, |
| 1298 | parent_line, |
| 1299 | extra.data.lhs, |
| 1300 | false, |
| 1301 | ); |
| 1302 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1303 | file, |
| 1304 | parent_scope, |
| 1305 | parent_line, |
| 1306 | extra.data.rhs, |
| 1307 | false, |
| 1308 | ); |
| 1309 | |
| 1310 | const lhs_index = self.exprs.items.len; |
| 1311 | try self.exprs.append(self.arena, lhs.expr); |
| 1312 | const rhs_index = self.exprs.items.len; |
| 1313 | try self.exprs.append(self.arena, rhs.expr); |
| 1314 | self.exprs.items[binop_index] = .{ .binOp = .{ |
| 1315 | .name = @tagName(tags[inst_index]), |
| 1316 | .lhs = lhs_index, |
| 1317 | .rhs = rhs_index, |
| 1318 | } }; |
| 1319 | |
| 1320 | return DocData.WalkResult{ |
| 1321 | .typeRef = .{ .type = @enumToInt(Ref.bool_type) }, |
| 1322 | .expr = .{ .binOpIndex = binop_index }, |
| 1323 | }; |
| 1324 | }, |
| 1281 | 1325 | |
| 1282 | 1326 | // builtin functions |
| 1283 | 1327 | .align_of, |