mirror of
https://github.com/janet-lang/janet
synced 2025-01-11 16:10:27 +00:00
Fix assembler bug.
This commit is contained in:
parent
6050a080b6
commit
5d290a67bf
@ -294,7 +294,7 @@ static int32_t doarg_1(
|
||||
ret = dst_unwrap_integer(result);
|
||||
}
|
||||
} else {
|
||||
dst_asm_errorv(a, dst_formatc("unknown name %q", x));
|
||||
dst_asm_errorv(a, dst_formatc("unknown name %v", x));
|
||||
}
|
||||
} else if (argtype == DST_OAT_TYPE || argtype == DST_OAT_SIMPLETYPE) {
|
||||
const TypeAlias *alias = dst_strbinsearch(
|
||||
@ -305,7 +305,7 @@ static int32_t doarg_1(
|
||||
if (alias) {
|
||||
ret = alias->mask;
|
||||
} else {
|
||||
dst_asm_errorv(a, dst_formatc("unknown type %q", x));
|
||||
dst_asm_errorv(a, dst_formatc("unknown type %v", x));
|
||||
}
|
||||
} else {
|
||||
goto error;
|
||||
@ -314,7 +314,7 @@ static int32_t doarg_1(
|
||||
/* Add a new env */
|
||||
ret = dst_asm_addenv(a, x);
|
||||
if (ret < -1) {
|
||||
dst_asm_errorv(a, dst_formatc("unknown environment %q", x));
|
||||
dst_asm_errorv(a, dst_formatc("unknown environment %v", x));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -48,6 +48,12 @@
|
||||
[name & more]
|
||||
(apply1 tuple (array.concat @['def name :private] more)))
|
||||
|
||||
(defmacro defasm
|
||||
"Define a function using assembly"
|
||||
[name & body]
|
||||
(def tab (apply1 table body))
|
||||
(tuple 'def name (tuple asm (tuple 'quote tab))))
|
||||
|
||||
# Basic predicates
|
||||
(defn even? [x] (== 0 (% x 2)))
|
||||
(defn odd? [x] (not= 0 (% x 2)))
|
||||
|
Loading…
Reference in New Issue
Block a user