Skip to content

Commit b3865d9

Browse files
committed
fix asm block erroring on deferred constants
1 parent e06b406 commit b3865d9

File tree

6 files changed

+47
-3
lines changed

6 files changed

+47
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "customasm"
3-
version = "0.13.9"
3+
version = "0.13.10"
44
edition = "2021"
55
authors = ["hlorenzi <https://hlorenzi.com>"]
66
description = "An assembler for custom, user-defined instruction sets!"

src/asm/resolver/eval_asm.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ fn resolve_iteratively(
9494
iter_count += 1;
9595

9696
let is_first_iteration = iter_count == 1;
97-
let is_last_iteration = iter_count == max_iterations;
97+
let is_last_iteration =
98+
iter_count == max_iterations &&
99+
ctx.is_last_iteration;
98100

99101
let result = resolve_once(
100102
opts,
@@ -124,7 +126,7 @@ fn resolve_iteratively(
124126
position_at_start,
125127
labels,
126128
false,
127-
true)?;
129+
ctx.is_last_iteration)?;
128130

129131
if !result.unstable
130132
{
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ruledef
2+
{
3+
emit {x: i8} => x
4+
test {x} => {
5+
asm { emit {x} + y.z }
6+
}
7+
}
8+
9+
test 2 ; = 0x22
10+
y:
11+
.z = 0x20
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ruledef
2+
{
3+
emit {x: i8} => x
4+
test {x} => {
5+
asm { emit {x} + y.z }
6+
}
7+
}
8+
9+
test 2 ; = 0x23
10+
y:
11+
.z = y + 0x20

tests/expr_asm/ok_arg_label.asm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ruledef
2+
{
3+
emit {x: i8} => x
4+
test {x} => {
5+
asm { emit {x} + y }
6+
}
7+
}
8+
9+
y:
10+
test 2 ; = 0x02
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ruledef
2+
{
3+
emit {x: i8} => x
4+
test {x} => {
5+
asm { emit {x} + y }
6+
}
7+
}
8+
9+
test 2 ; = 0x03
10+
y:

0 commit comments

Comments
 (0)