mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Issue #90 - Typecheck port argument
This commit is contained in:
parent
bb2a3bb031
commit
4d5a1cc076
1 changed files with 14 additions and 2 deletions
16
runtime.c
16
runtime.c
|
@ -645,7 +645,13 @@ object Cyc_display_va_list(int argc, object x, va_list ap)
|
|||
if (argc > 1) {
|
||||
object tmp;
|
||||
tmp = va_arg(ap, object);
|
||||
fp = ((port_type *) tmp)->fp;
|
||||
if (Cyc_is_port(tmp) == boolean_t) {
|
||||
fp = ((port_type *) tmp)->fp;
|
||||
} else {
|
||||
// TODO: need a data arg, and should raise an error here instead
|
||||
fprintf(stderr, "Bad argument: expected port\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
return Cyc_display(x, fp);
|
||||
}
|
||||
|
@ -802,7 +808,13 @@ object Cyc_write_va_list(int argc, object x, va_list ap)
|
|||
if (argc > 1) {
|
||||
object tmp;
|
||||
tmp = va_arg(ap, object);
|
||||
fp = ((port_type *) tmp)->fp;
|
||||
if (Cyc_is_port(tmp) == boolean_t) {
|
||||
fp = ((port_type *) tmp)->fp;
|
||||
} else {
|
||||
// TODO: need a data arg, and should raise an error here instead
|
||||
fprintf(stderr, "Bad argument: expected port\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
return Cyc_write(x, fp);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue