From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 8FYwM31dGGdw8wAAqHPOHw:P1 (envelope-from ) for ; Wed, 23 Oct 2024 04:20:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 8FYwM31dGGdw8wAAqHPOHw (envelope-from ) for ; Wed, 23 Oct 2024 04:20:45 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=mIjUq0rc; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=A9gC7WPB; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1"); dmarc=pass (policy=none) header.from=maniero.me ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1729650045; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=j/gaRI7AiIBRj+t+AGnVaikzfGm1W8lj0NjlPXxYcYc=; b=mCOopb5VsqSFbMK0AD6YVMQ8IlwMkhRxIJIfxhZj+XnAkjk/xPpwwbOg5gwUrS5exFfXXS H9z6ifQqZsqQ8J6DKABNbd+k8Bqm9r59PeoiXQeGEGpRRsq0mI0VSpjtFqTO8T5iWTjjYh NKNO0XNFt+iaWTRhmcJtv3oAr9ksoDlXY5KyNhw6PkMqwP4ayX7NiJa8/xEZ3Ots5UuhQb plhteTVthyxTbSZdAhqosC0ub3xcGD1DIejGFpt2uWOlbStT9pfKTRfSvFHDYXvLERdir3 Ah3n2zfRAxxkzIaqF7Wy+B+BAVa3XtRR0XG3QKMZaWD+5bkoYlC0RLhET2GVeA== ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1729650045; a=rsa-sha256; cv=pass; b=0DiXh7MEdDN+ReyNW5osdu+BkeQdE+k/Fyt8mvfJbopsnwUlF1msX4RGznyig4+JuKi66n eTMZJAMoFoZimEOXxWKGJcxKLYLq9YXiNIILQDTis6/ThEWMfUJUbUxUj35EtszBqTzY4/ T+hZhf/tLVsUgOE5oJ0b3UpGuq3OWx3glZ1299dkyicGqGsy69V7TNrrjv7EUJhn33Wq58 8ByAHoaouXVvOGVjGF5mMgsZXMsvwl/RqKy66gdOCtylFgsCa3ykPPLkmAj2y4XL9lWtQB Bkken1v+GNPsaZgKNTPf4IpG1Lh9iAD7k8Erm0g61cqSBOlhOwibiNWEkmwbbg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=mIjUq0rc; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=A9gC7WPB; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1"); dmarc=pass (policy=none) header.from=maniero.me Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7D2435205E for ; Wed, 23 Oct 2024 04:20:45 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=GePRqUuKoVh3Osm4m76ZY/+66WO1b/IuAL0NqVjRQkQ=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:In-Reply-To:References:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1729650045; v=1; b=mIjUq0rc+m0ROa51yZ90rxwC1bbg2opcFnZI0uGIyosUs3sX3I4Yyg4Hxz30F168OWqWAGc4 PPPzO+ZjRX5oS2AoUVhjdZGHUbpnBeU2JBQ9vgpBdhgelW8aM9p/cluMPzffk/oBdDnVLDQL4F+ gkCKdA9XDNImFa/JYlSIHsTZ6pnBNX5so0ExKp91qML0gyD8krOy9JgtIm74jDyAVrbPdMIYXia +wOF1GAiONMA9wuEuP0m09kze56xr1leF5myE2vOrv/3H0GfSgFFBRT64uYFjPPSfKsmEJTNKjF gg52JF5dj3akjt5biXm5NTYOlSp7vDMAlmAuJIn/8FTSw== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 369C9202DE for ; Wed, 23 Oct 2024 02:20:45 +0000 (UTC) Received: from crocodile.elm.relay.mailchannels.net (crocodile.elm.relay.mailchannels.net [23.83.212.45]) by mail-a.sr.ht (Postfix) with ESMTPS id 4FDAA202B1 for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 23 Oct 2024 02:20:44 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D0CCE16418D for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 23 Oct 2024 02:20:42 +0000 (UTC) Received: from fr-int-smtpout5.hostinger.io (trex-5.trex.outbound.svc.cluster.local [100.103.26.202]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 1A3D3163F54 for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 23 Oct 2024 02:20:41 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729650042; a=rsa-sha256; cv=none; b=kFxqYBqA094tou6sCLBY0YdaFWnCl4hN9tKoq1BAe1GO45EM6gW2AupFB2dDBqbJNVUBmk hIO9eKLPgRs2ExNpLcdI+SbEaJaid0UTFydwJtsNTCQH52fsvl2oIDyM5QTKs8nF+sV/DB asFv4tDlEC4bLOvKftolJcK+UKnrbzVSNilXJ59NrvfpbM/aUFy7wXNeON1cRJZJM/ge9/ KYJ2ofZ++DPqOsmMAFOvVv1kWTfoUbJgWdlsQYR/IKHzn87i5Qulbp33W/Ry6EcTOIfj9D 8jQLTxfomVOmL4ao3UAl5treogeWH2AV/dLeWdkWi+fcQSD7oYyzTo9wxvXgvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729650042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=j/gaRI7AiIBRj+t+AGnVaikzfGm1W8lj0NjlPXxYcYc=; b=sO80dgcv/7M92rj+stETrSgIL/V/IviT7cm+XInZzlDYvss4gp+8EV0pseLwd05EBvCTbx /koAdpgiQ56FMl3mC+kgQOoot4fbAmFXLRVyCxLHB3NmpLsRtcOEknb8HBiWDY3xFZijqa /QOkNUj+6I0yAqHS9YRFQnW+3dxEe3RxeXwp51JwQHBPMnUarUUQt8lJAQ9tZIJ/Ur6A8G XB+UdVDFMgWhxzjsD22/FMv+77lMDe4wLQIJd1yD6uFMvjtLqO+LcWvUD0nRi18Y6sJ1D+ EnDzn5qZesJn8xbgWn4LXEenVbWN4S6BvhS3sjjK8rK5fzQRhxCrDs2EmPviVw== ARC-Authentication-Results: i=1; rspamd-5bbb596db8-vzs79; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Thoughtful-Spot: 049361047611af70_1729650042755_2307237307 X-MC-Loop-Signature: 1729650042755:360991971 X-MC-Ingress-Time: 1729650042754 Received: from fr-int-smtpout5.hostinger.io (fr-int-smtpout5.hostinger.io [89.116.146.168]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.26.202 (trex/7.0.2); Wed, 23 Oct 2024 02:20:42 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1729650040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j/gaRI7AiIBRj+t+AGnVaikzfGm1W8lj0NjlPXxYcYc=; b=A9gC7WPBusA07zW2bkKzSPuxqRc+SsNYj+EkojmBbFDCtF5FhnlU4xkblRAkJ9R5C9DEp7 QfQsSROmfUwvuO8QUFcmUoKTyT0KOleSGf1QoPzD3415LYMvVBIfpN4wrVYzlRhFqg/hCO /oyk+/bEm7ug/eIFxZSNpPCuIQj/ezgXIAy/VBbEAGYCkJn5zzxqxOa/N0SqvGclwEPXXB 9DvGZY34xLw7jVJW9NlsTOXvdw3e0htwIz8ZmJt1nuhMXEy9sFz/ihBocxGc5YaPOeUEj4 /CeXMVuE35qxwUtzHHmOaBsa3Z7BpKZ0A8mqhwcbhiJ9VvxecWhle/4eQTZ9kw== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1 3/5] ast: unary: rename ast_unary.expr to ast_unary.operand Message-ID: <20241023022022.38379-4-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241023022022.38379-1-carlos@maniero.me> References: <20241023022022.38379-1-carlos@maniero.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Wed, 23 Oct 2024 02:20:39 +0000 (UTC) X-CM-Envelope: MS4xfCFABCruzlhDTknmG7xk4/oxF4wrekYL6V13AAgUD/9A2mlWBfa3vUY1Y1WJ930+V+eqS3PWcZTDGVmeRmAt+Kw+tX+rWjq2cismff7PmyRgCwd+NZJa K/T7yuGV62Os06AA2AonaIIHqoXexJh3C8K/GvySKk46IYtv7tH8qrbxNpAJF3HqH5ED/B/tKRqQx1LvRxzvqx1MYIx5ppKVvBNWpOorPnpItOzO7INb+DNc X-CM-Analysis: v=2.4 cv=Z6G+H2RA c=1 sm=1 tr=0 ts=67185d78 a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=iAD7BQJ3AWpOZcF-KQ0A:9 a=BXDaF_L80NY05PYiAFlV:22 X-AuthUser: carlos@maniero.me X-Sourcehut-Patchset-Status: UNKNOWN List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Spam-Score: -4.81 X-Spam-Score: -4.81 X-Migadu-Queue-Id: 7D2435205E X-Migadu-Scanner: mx13.migadu.com X-TUID: jcrVOyxMgh4C This is a more meaningful name for the given context. Signed-off-by: Carlos Maniero --- src/ast.c | 4 ++-- src/ast.h | 4 ++-- src/codegen_x86_64.c | 12 ++++++------ src/pretty_print_ast.c | 2 +- src/type_checker.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ast.c b/src/ast.c index d0c6b37..eef01ce 100644 --- a/src/ast.c +++ b/src/ast.c @@ -137,7 +137,7 @@ ast_node_t * ast_new_node_unary_op(arena_t *arena, token_loc_t loc, ast_unary_op_kind_t kind, - ast_node_t *expr) + ast_node_t *operand) { ast_node_t *node_unary_op = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t)); @@ -146,7 +146,7 @@ ast_new_node_unary_op(arena_t *arena, node_unary_op->kind = AST_NODE_UNARY_OP; node_unary_op->loc = loc; node_unary_op->as_unary_op.kind = kind; - node_unary_op->as_unary_op.expr = expr; + node_unary_op->as_unary_op.operand = operand; return node_unary_op; } diff --git a/src/ast.h b/src/ast.h index c7a25bf..9d82317 100644 --- a/src/ast.h +++ b/src/ast.h @@ -175,7 +175,7 @@ typedef struct ast_unary_op { AST_NODE_HEAD; ast_unary_op_kind_t kind; - ast_node_t *expr; + ast_node_t *operand; } ast_unary_op_t; typedef struct ast_var_assign_stmt @@ -260,7 +260,7 @@ ast_node_t * ast_new_node_unary_op(arena_t *arena, token_loc_t loc, ast_unary_op_kind_t kind, - ast_node_t *expr); + ast_node_t *operand); ast_node_t * ast_new_node_literal_u32(arena_t *arena, token_loc_t loc, uint32_t value); diff --git a/src/codegen_x86_64.c b/src/codegen_x86_64.c index deb7e24..933a42d 100644 --- a/src/codegen_x86_64.c +++ b/src/codegen_x86_64.c @@ -653,8 +653,8 @@ codegen_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr_node) ast_unary_op_t unary_op = expr_node->as_unary_op; switch (unary_op.kind) { case AST_UNARY_BITWISE_NOT: { - size_in_bytes_t expr_bytes = - codegen_x86_64_emit_expression(codegen, unary_op.expr); + size_in_bytes_t expr_bytes = codegen_x86_64_emit_expression( + codegen, unary_op.operand); fprintf(codegen->out, " not %s\n", @@ -663,10 +663,10 @@ codegen_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr_node) return expr_bytes; } case AST_UNARY_ADDRESSOF: { - assert(unary_op.expr->kind == AST_NODE_REF && + assert(unary_op.operand->kind == AST_NODE_REF && "unsupported unary expression for addressof (&)"); - ast_ref_t ref = unary_op.expr->as_ref; + ast_ref_t ref = unary_op.operand->as_ref; symbol_t *symbol = scope_lookup(ref.scope, ref.id); assert(symbol); @@ -680,11 +680,11 @@ codegen_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr_node) } case AST_UNARY_DEREFERENCE: { // FIXME: support dereference of dereference (**) - assert(unary_op.expr->kind == AST_NODE_REF && + assert(unary_op.operand->kind == AST_NODE_REF && "unsupported unary expression for dereference (*)"); return codegen_x86_64_emit_expression(codegen, - unary_op.expr); + unary_op.operand); } default: { assert(0 && "unsupported unary operation"); diff --git a/src/pretty_print_ast.c b/src/pretty_print_ast.c index d476370..d18fa56 100644 --- a/src/pretty_print_ast.c +++ b/src/pretty_print_ast.c @@ -440,7 +440,7 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena) } pretty_print_node_t *expr = - ast_node_to_pretty_print_node(unary_op.expr, arena); + ast_node_to_pretty_print_node(unary_op.operand, arena); list_append(node->children, expr); return node; diff --git a/src/type_checker.c b/src/type_checker.c index b426349..53c2e05 100644 --- a/src/type_checker.c +++ b/src/type_checker.c @@ -189,7 +189,7 @@ populate_scope(checker_t *checker, scope_t *scope, ast_node_t *ast) case AST_NODE_UNARY_OP: { ast_unary_op_t unary_op = ast->as_unary_op; - populate_scope(checker, scope, unary_op.expr); + populate_scope(checker, scope, unary_op.operand); return; } -- 2.46.1