From 3063326dd0a5adbf3a569df87c016671ceb0de67 Mon Sep 17 00:00:00 2001 From: cassowarii Date: Sun, 28 Jun 2026 21:58:37 -0700 Subject: [PATCH] update comments --- src/compile/ir.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/compile/ir.c b/src/compile/ir.c index 9fca3ed..aa1e860 100644 --- a/src/compile/ir.c +++ b/src/compile/ir.c @@ -239,11 +239,15 @@ static void compile_ast_stmt(hIrChunk ck, sbAst node) { * LET a * a = 3 * + * LET a, b = 5, 6 + * linearizes to: + * LET a, b + * a = 5 + * b = 6 + * * "LET a" doesn't actually appear in the output IR code, * but it allows us to interpret the name "a" inside the * current block to refer to a consistent variable slot. - * TODO: I need to add support for declaring multiple - * variables in one line. */ if (node->seq.right == NO_NODE) { /* let ... */ @@ -284,6 +288,17 @@ static void compile_ast_stmt(hIrChunk ck, sbAst node) { break; case AST_NODE_ASSIGN: + /* + * x, y, z = 1, 2, 3 + * linearizes to + * x = 1 + * y = 2 + * z = 3 + * + * TODO: For things that are not straight variable names, + * we need to convert them to the appropriate method calls. + * Right now we don't have method calls, but eventually, we + * will have them. */ if (node->seq.left->type != AST_NODE_MULTIVAL) PANIC("expected multival on left side of assign!"); if (node->seq.right->type != AST_NODE_MULTIVAL) PANIC("expected multival on right side of assign!"); N1 = node->seq.left; /* things to bind to */ -- 1.8.3.1