mirror of
https://github.com/janet-lang/janet
synced 2025-01-25 22:56:52 +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);
|
ret = dst_unwrap_integer(result);
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
} else if (argtype == DST_OAT_TYPE || argtype == DST_OAT_SIMPLETYPE) {
|
||||||
const TypeAlias *alias = dst_strbinsearch(
|
const TypeAlias *alias = dst_strbinsearch(
|
||||||
@ -305,7 +305,7 @@ static int32_t doarg_1(
|
|||||||
if (alias) {
|
if (alias) {
|
||||||
ret = alias->mask;
|
ret = alias->mask;
|
||||||
} else {
|
} else {
|
||||||
dst_asm_errorv(a, dst_formatc("unknown type %q", x));
|
dst_asm_errorv(a, dst_formatc("unknown type %v", x));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
goto error;
|
goto error;
|
||||||
@ -314,7 +314,7 @@ static int32_t doarg_1(
|
|||||||
/* Add a new env */
|
/* Add a new env */
|
||||||
ret = dst_asm_addenv(a, x);
|
ret = dst_asm_addenv(a, x);
|
||||||
if (ret < -1) {
|
if (ret < -1) {
|
||||||
dst_asm_errorv(a, dst_formatc("unknown environment %q", x));
|
dst_asm_errorv(a, dst_formatc("unknown environment %v", x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -48,6 +48,12 @@
|
|||||||
[name & more]
|
[name & more]
|
||||||
(apply1 tuple (array.concat @['def name :private] 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
|
# Basic predicates
|
||||||
(defn even? [x] (== 0 (% x 2)))
|
(defn even? [x] (== 0 (% x 2)))
|
||||||
(defn odd? [x] (not= 0 (% x 2)))
|
(defn odd? [x] (not= 0 (% x 2)))
|
||||||
|
Loading…
Reference in New Issue
Block a user