got type system working
This commit is contained in:
@@ -2,6 +2,9 @@ import { defineCommand } from "@bunli/core";
|
||||
import { boringGrammar } from "../parse/grammar";
|
||||
import { semantics } from "../parse/semantics";
|
||||
import TraitChecker from "../types/trait_checker";
|
||||
import { TypeAliasResolver } from "../types/type_alias_resolution";
|
||||
import { TypeSystem } from "../types/type_system";
|
||||
import { TypeChecker } from "../types/type_checker";
|
||||
|
||||
export const run = defineCommand({
|
||||
name: "run",
|
||||
@@ -22,8 +25,14 @@ export const run = defineCommand({
|
||||
const adapter = semantics(match);
|
||||
const ast = adapter.toAST();
|
||||
new TraitChecker().withModule(ast);
|
||||
const aliasResolvedAst = new TypeAliasResolver().withModule(ast);
|
||||
const typeSystem = new TypeSystem();
|
||||
const typeChecker = new TypeChecker();
|
||||
typeChecker.withModule(aliasResolvedAst, typeSystem);
|
||||
typeSystem.solve();
|
||||
console.log(JSON.stringify(typeSystem, null, 2));
|
||||
|
||||
console.log(JSON.stringify(ast, null, 2));
|
||||
// console.log(JSON.stringify(aliasResolvedAst, null, 2));
|
||||
} else {
|
||||
console.log(match.message);
|
||||
// console.log(boringGrammar.trace(text, "Module").toString());
|
||||
|
||||
Reference in New Issue
Block a user