mirror of
https://github.com/janet-lang/janet
synced 2025-01-10 07:30:26 +00:00
Stub out type inference pass.
This commit is contained in:
parent
fdbf4f2666
commit
46bda4e6fa
@ -31,6 +31,7 @@
|
|||||||
* [ ] named fields (for debugging mostly)
|
* [ ] named fields (for debugging mostly)
|
||||||
* [x] named registers and types
|
* [x] named registers and types
|
||||||
* [x] better type errors (perhaps mostly for compiler debugging - full type system goes on top)
|
* [x] better type errors (perhaps mostly for compiler debugging - full type system goes on top)
|
||||||
|
* [ ] support for switch-case
|
||||||
* [ ] x86/x64 machine code target
|
* [ ] x86/x64 machine code target
|
||||||
* [ ] target specific extensions - custom instructions and custom primitives
|
* [ ] target specific extensions - custom instructions and custom primitives
|
||||||
* [ ] better casting semantics
|
* [ ] better casting semantics
|
||||||
@ -928,7 +929,21 @@ static JanetString rname(JanetSysIR *sysir, uint32_t regid) {
|
|||||||
|
|
||||||
static void janet_sysir_type_check(JanetSysIR *sysir) {
|
static void janet_sysir_type_check(JanetSysIR *sysir) {
|
||||||
|
|
||||||
/* TODO - type inference */
|
/* Simple forward type inference */
|
||||||
|
int forward_progress;
|
||||||
|
do {
|
||||||
|
forward_progress = 0;
|
||||||
|
for (uint32_t i = 0; i < sysir->instruction_count; i++) {
|
||||||
|
JanetSysInstruction instruction = sysir->instructions[i];
|
||||||
|
switch (instruction.opcode) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case JANET_SYSOP_MOVE:
|
||||||
|
tcheck_equal(sysir, instruction.two.dest, instruction.two.src);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (forward_progress);
|
||||||
|
|
||||||
/* Assert no unknown types */
|
/* Assert no unknown types */
|
||||||
for (uint32_t i = 0; i < sysir->register_count; i++) {
|
for (uint32_t i = 0; i < sysir->register_count; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user