mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-07 05:06:37 +02:00
adding type checking to disasm
Fixes issue #8: http://code.google.com/p/chibi-scheme/issues/detail?id=8 Note disasm is likely to be moved out of the core soon.
This commit is contained in:
parent
fa879e183c
commit
9ed0d705c6
1 changed files with 7 additions and 1 deletions
|
@ -20,8 +20,14 @@ static const char* reverse_opcode_names[] =
|
|||
|
||||
static sexp sexp_disasm (sexp ctx, sexp bc, sexp out) {
|
||||
unsigned char *ip, opcode;
|
||||
if (sexp_procedurep(bc))
|
||||
if (sexp_procedurep(bc)) {
|
||||
bc = sexp_procedure_code(bc);
|
||||
} else if (sexp_opcodep(bc)) {
|
||||
sexp_printf(ctx, out, "%s is a primitive\n", sexp_opcode_name(bc));
|
||||
return SEXP_VOID;
|
||||
} else if (! sexp_bytecodep(bc)) {
|
||||
return sexp_type_exception(ctx, "not a procedure", bc);
|
||||
}
|
||||
ip = sexp_bytecode_data(bc);
|
||||
loop:
|
||||
opcode = *ip++;
|
||||
|
|
Loading…
Add table
Reference in a new issue