From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qBaENUEJDWemMQAAe85BDQ:P1 (envelope-from ) for ; Mon, 14 Oct 2024 14:06:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id qBaENUEJDWemMQAAe85BDQ (envelope-from ) for ; Mon, 14 Oct 2024 14:06:26 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b="lXss/MN7"; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=QQbg3L3C; dmarc=pass (policy=none) header.from=maniero.me; 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") ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1728907585; a=rsa-sha256; cv=pass; b=uqv0f1sN/w7MmIpuC9uMbc4TIB72XjTG+Xav4HKi/BaUmo6FAhVV1zlRtXYUn25TiOtT8p I7ruknOeTa9SZ9a29oD6z6k59e94N9M20ksGHD8lCNrKK2pCra1jemcQq7XFoMgZ7iFwMO LRz3gXlUoCg0zZu+NDN2d3xObEBNwaO28gewlEWFnb6ofLXYa7MzIC+hkCV+AgwzCSQwey 9hWkUl8/XhCJx4x4ylfXBBdWbDJzlR0/ElOe3GbuQzCAoaeissIr8UAlRJAc3U4GhXin9p 84BQK/Mkxt9sOhburY5LMC0+O+v2EV3ZzdXbwI1I3THY4+EeLycu11y6FgZ47w== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b="lXss/MN7"; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=QQbg3L3C; dmarc=pass (policy=none) header.from=maniero.me; 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") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1728907585; 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=FuYBpVpvSylrgh7BlZmfc/GC61VyCM6ar1MjN1VlF6c=; b=1MR8u78wjb2LrFltbtTgLfGsKJFTRUXox1mRSvjLtzQ/QW5UBDw5evpKxbiVYiMPS9qeK3 zxINvf4SmDYFJqYnSYaAjGaQzp4OLetQD0W7XUBhlWgyThyJf8CkdbQcTQ6gwB3CVlvoIH s6ZI0FMaQsOkx3bHtjF9b8eDdPv695GGAAFX5d98KLejZmgRZhAruPoUAN24HhcFzvFMMM lHaE0C0SYaZ5osjWEpLu15sQf8dillEqVObKwydu316OlSJpHp5W9gA3Kh1HP6rGkbgOYq 3NwIIAxBY+W0qTGMiWx2qNKbRblYj+nMFkJzKNXSiN2Cw/3O9cMPzNqFeDhWdg== 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 BF74062B31 for ; Mon, 14 Oct 2024 14:06:25 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=hSQED8nvuihlezEjOVIjNe8/02OHnBxWs9ytCIQeBjM=; 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=1728907585; v=1; b=lXss/MN7n4QgNVMBsD+7wTyLJwbpNK++G7EpLTEs5KS6jD8qZIx+6vv2ElyKFEngFqKBUKK2 UaZuQEnv4gyX9ZUlNBgR+wBhaxlU74WBoq5oS/NRWE8dNsF4mVHV6YU2iix1+b9Kcwnn+BdIoOI MTV6aPAju5Fd8Y9+3MU4iloGjBwyqT0CWgrAXZCrM2JA+3MSz95yrY+FQL7ewuO0gD3tPHenh2N orbqW2dU8kOdkWoNdlpC2+xN856a22tSI5pJsXfCza+9J+NtHw9vOYz4P2nzHeSeWxR9KE57DM3 rnWQRJBDE70ezgq+1o/aNFP/MiUB2sNl6uHau1S9ZIRjA== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 9981C201D6 for ; Mon, 14 Oct 2024 12:06:25 +0000 (UTC) Received: from dormouse.ash.relay.mailchannels.net (dormouse.ash.relay.mailchannels.net [23.83.222.50]) by mail-a.sr.ht (Postfix) with ESMTPS id B0A062014C for <~johnnyrichard/olang-devel@lists.sr.ht>; Mon, 14 Oct 2024 12:06:24 +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 122451635B4 for <~johnnyrichard/olang-devel@lists.sr.ht>; Mon, 14 Oct 2024 12:06:23 +0000 (UTC) Received: from uk-fast-smtpout10.hostinger.io (100-102-3-254.trex-nlb.outbound.svc.cluster.local [100.102.3.254]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 6670B163950 for <~johnnyrichard/olang-devel@lists.sr.ht>; Mon, 14 Oct 2024 12:06:22 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1728907582; a=rsa-sha256; cv=none; b=lgruuM8G5buzhAU3MBMply03/3uvWp/+OMa95nmscKG287EUm0wdo0kQ12EgkyLN0R9Krj TZr5DdsB68uTAt87qmA6a1/v314folg4mvcxioT3bl9wGL6bXr7hP56xkoFfUp/jVplfr8 T9OGOSHl9kO53j3SwV3zeFZfEW8MvWmwvInGN3el1QTCP7+Mm8XCiCd55fRExf3+f1O6o3 FnhDySfAMY92zu9gLhMqLyVneCYha/ES1UacT598NCYC6PhWoZwNdossur5ZD+tZrZP/DU VDRkOzNzd/nzdU3LSuCy1r4jThO7eN6WDiEhHUDnqN/qszfbxWQdXDGEGiA2oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1728907582; 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=FuYBpVpvSylrgh7BlZmfc/GC61VyCM6ar1MjN1VlF6c=; b=Vv4mPvWSh1cmiLUZrYGAxkvyf9eF7Rn6Ej12V1sF6lHK5hkx3PvRykbv63ZDmSQ8u79Xqu Nruvf9ADZGTOvjVYGVrEJpiYMmpnHUbhhYNiN5V9VJwjhAghGzBIWBTzqVuSgas2zauhIP fWw32o9CWFwvUa3jV6zc02pG+8awPuiZ5MaiW3520OHxhsDaST1zOvKpxbql2SSJApmQtK dIFBq2w7DNUAGN71/taANuPuzQPympI2DgMcu8UCadse9uTwPKEOOqoYos+VNMcPcSNkw+ ZNShF5B7AU4AgBeR+J8qgD8F+Go5rJMDfLZtuxnQ4C7hzgBQnlSG1LNCZPh+9A== ARC-Authentication-Results: i=1; rspamd-6b8cf4b767-645xn; 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-Stop-Minister: 20a784911ec2c8f4_1728907582899_2093000923 X-MC-Loop-Signature: 1728907582899:2085202046 X-MC-Ingress-Time: 1728907582899 Received: from uk-fast-smtpout10.hostinger.io (uk-fast-smtpout10.hostinger.io [145.14.155.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.102.3.254 (trex/7.0.2); Mon, 14 Oct 2024 12:06:22 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1728907580; 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=FuYBpVpvSylrgh7BlZmfc/GC61VyCM6ar1MjN1VlF6c=; b=QQbg3L3C8tiVPv4f+1lYWyzSmj5FNm+mgK0uTiCvOhhfvfc6YGxpjRo2jFqC8Fkh/Pknzz FJU7dE19+gRY4oR9tqrVlzNjYO31cwws9wnGcM1vWpoLIIFSR4F8JbrgOAQyrWfustvhvK nCSv24ibn3Ox1Z/WmrGQ69pRyE7OflQ5c61sKg4CtnFYazaOd3rj1bEVEXBNZYmO7EFxHR yK3LMZQR2Mjrwb1m6Es58o4ipYlHOHQSfmVucICGITCHIKfJgGvZD7g/LV27K5+Z5Vn0Up 7P7b4ztLLQ/XYIQj1EI/zn8xZVMNQyK3EtXtzLP3Ctc/bWC/yUQQdglxeSP0DQ== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1 1/3] fix: checker: populate vardef value scope Message-ID: <20241014120607.90304-2-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241014120607.90304-1-carlos@maniero.me> References: <20241014120607.90304-1-carlos@maniero.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Mon, 14 Oct 2024 12:06:20 +0000 (UTC) X-CM-Analysis: v=2.4 cv=TcnEtgQh c=1 sm=1 tr=0 ts=670d093c a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=mooWip3dLkymmGPnlCEA:9 a=BXDaF_L80NY05PYiAFlV:22 X-CM-Envelope: MS4xfMxT0TCTGWSDIoUd20L9awSxJ9UIkck363lJyAhS4QZL+hTnacCnRAXK5gxSRUnwqV7eMI4u6/G0BFAcB59/VIVAUc78jH4WQ7Yo2D6V3TuGFhSaBRGd gqo/hJfCKZP5vC4jTsh94RST0H7AlOzW/gyOiSXsoHZJBI7D7g6+dDi3YxbANlUhY52L2STmTxhtqtlM7DufWS9kWfKqx3gj6DeE66nOoyEQMsg2y44jxHaC 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: -0.78 X-Spam-Score: -0.78 X-Migadu-Queue-Id: BF74062B31 X-Migadu-Scanner: mx12.migadu.com X-TUID: cXMTQ5RUhD+N It also include asserts on function enter to ensure the pointers are set. Signed-off-by: Carlos Maniero --- src/checker.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/checker.c b/src/checker.c index 1230c3c..0acab13 100644 --- a/src/checker.c +++ b/src/checker.c @@ -105,6 +105,9 @@ checker_check(checker_t *checker, ast_node_t *ast) static void populate_scope(checker_t *checker, scope_t *scope, ast_node_t *ast) { + assert(checker); + assert(scope); + switch (ast->kind) { case AST_NODE_TRANSLATION_UNIT: { list_item_t *item = list_head(ast->as_translation_unit.decls); @@ -219,6 +222,8 @@ populate_scope(checker_t *checker, scope_t *scope, ast_node_t *ast) scope_insert(scope, symbol); ast->as_var_def.scope = scope; + + populate_scope(checker, scope, ast->as_var_def.value); return; } -- 2.46.1