about summary refs log tree commit diff
path: root/compile.c
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2026-04-07 05:04:48 +0300
committerNakidai <nakidai@disroot.org>2026-04-07 05:04:48 +0300
commit75a1470fd2270eca5f9772b6ed8ad7517eeb30d8 (patch)
treeacb13aa5f15007de24e158be96e683c3f72b2fc4 /compile.c
parentce8647d2378514e9a77a86639dd23f1adf0f3808 (diff)
downloadthac-75a1470fd2270eca5f9772b6ed8ad7517eeb30d8.tar.gz
thac-75a1470fd2270eca5f9772b6ed8ad7517eeb30d8.zip
Fix some minor issues
- in the OASSIGN of the roper, i=0 means variable is _found_ as the
  first one in the scope, so it should be freed
- in the rwith, nwith is stored by the node, not mod (affects only
  printing of the "s", though, lol)
- in add{edge,prop} target is ulong, so check >=0 is redundant
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index d488414..dc070ca 100644
--- a/compile.c
+++ b/compile.c
@@ -106,7 +106,7 @@ roper(struct node *node, struct scope *scope)
 		val = getval(VVAR, eval(node->noper.l, scope), scope, 0);
 		lscope = scope;
 		i = findvar(val.name, &lscope);
-		if (i > 0)
+		if (i >= 0)
 			shouldfree = deref(val, scope);
 
 		r = deref(eval(node->noper.r, scope), scope);
@@ -402,7 +402,7 @@ rwith(struct node *node, struct scope *scope)
 			mod->nmod.len,
 			mod->nmod.len != 1 ? "s" : "",
 			node->nwith.len,
-			mod->nwith.len != 1 ? "s" : ""
+			node->nwith.len != 1 ? "s" : ""
 		);
 
 	argscope.len = mod->nmod.len;