Skip to content

Commit d7d160b

Browse files
committed
Fix serialization for the most part and work on incremental compilation
1 parent 077a401 commit d7d160b

13 files changed

Lines changed: 879 additions & 758 deletions

File tree

src/codegen.pr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def emit_structure(fp: File, structure: &typechecking::Type) {
694694
def emit_union(fp: File, union_: &typechecking::Type) {
695695
var name = union_.type_name
696696
if not name {
697-
name = "<anonymous " + union_.id + ">"
697+
name = "<anonymous " + union_._hash + ">"
698698
}
699699

700700
fprint(fp, "%\"", name, "\"")

src/compiler.pr

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ def walk_String(node: &parser::Node, state: &State) -> Value {
13091309
return ret
13101310
}
13111311

1312-
def resolve_types(res: &Vector(TypeEntry)) {
1312+
export def resolve_types(res: &Vector(TypeEntry)) {
13131313
let state = toolchain::types_state
13141314
// We need an independent block that we can run for constant evaluation
13151315
let old_block = toolchain::types_state.current_block
@@ -9020,7 +9020,7 @@ export def resolve_stub_types {
90209020
lock = false
90219021
}*/
90229022

9023-
type TypeEntry = struct {
9023+
export type TypeEntry = struct {
90249024
tpe: &typechecking::Type
90259025
value: &scope::Value
90269026
module: weak &toolchain::Module
@@ -9107,17 +9107,20 @@ export def create_type(tpe: &typechecking::Type, module: &toolchain::Module, res
91079107

91089108
let state = toolchain::types_state
91099109
let assembly_name = scope::assembly_name(svalue, state)
9110-
if not map::contains(module.result.globals, assembly_name) {
9111-
let global = [
9112-
external = true,
9113-
name = assembly_name,
9114-
tpe = builtins::type_t(),
9115-
line = -1,
9116-
identifier = ident
9117-
] !&Global
9118-
module.result.add_global(global.name, global)
9119-
module.imported.add(global.name)
9110+
if module {
9111+
if not map::contains(module.result.globals, assembly_name) {
9112+
let global = [
9113+
external = true,
9114+
name = assembly_name,
9115+
tpe = builtins::type_t(),
9116+
line = -1,
9117+
identifier = ident
9118+
] !&Global
9119+
module.result.add_global(global.name, global)
9120+
module.imported.add(global.name)
9121+
}
91209122
}
9123+
91219124

91229125
let value = [
91239126
kind = ValueKind::GLOBAL,

src/debug.pr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ export def type_to_str(tpe: &typechecking::Type, full_name: bool = false) -> Str
883883
typechecking::TypeKind::INTERFACE,
884884
typechecking::TypeKind::TYPE_CONSTRUCTOR
885885
let name = tpe.type_name if full_name else tpe.name
886-
if not name { return "<anonymous " + tpe.id + ">" }
886+
if not name { return "<anonymous " + tpe._hash + ">" }
887887
return name
888888
case typechecking::TypeKind::TYPE
889889
return type_t_to_string(tpe, full_name)

src/scope.pr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,7 @@ def all_impl(scope: &Scope, module: &toolchain::Module, visited: &SSet, all: &Ve
20952095
// To fix this we need to stop recursing somehow-
20962096
export def trigger_impl(scope: &Scope, tpe: &typechecking::Type) {
20972097
if is_type(tpe) { return }
2098+
if tpe.kind == typechecking::TypeKind::TYPE_CONSTRUCTOR { return }
20982099

20992100
if tpe and tpe.kind != typechecking::TypeKind::REFERENCE {
21002101
trigger_impl(scope, typechecking::reference(tpe.id))

0 commit comments

Comments
 (0)