Skip to content

Commit

Permalink
The big thing works again
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed Jan 26, 2023
1 parent 859b390 commit 354c68c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/compiler.pr
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,7 @@ def convert_fp_to_closure(tpe: &typechecking::Type, value: Value, loc: &Value, s
var ret = { kind = ValueKind::ZEROINITIALIZER, tpe = tpe } !Value
value = state.bitcast(tpe.fields[0].tpe, value, loc)
ret = state.insert_value(tpe, ret, value, [0], loc)
add_type_meta(tpe, state)
return ret
}

Expand Down Expand Up @@ -1893,6 +1894,7 @@ def walk_Cast(node: &parser::Node, state: &State) -> Value {

let value = walk_and_load_expression(node.value.bin_op.left, state)
import_structures(node.tpe, state.module)
add_type_meta(node.tpe, state)
return convert_to(node, value, node.tpe, state)
}

Expand Down Expand Up @@ -2850,6 +2852,10 @@ def walk_Identifier(node: &parser::Node, state: &State) -> Value {
}

let tpe = node.tpe
if tpe and tpe.kind == typechecking::TypeKind::CLOSURE {
add_type_meta(tpe, state)
}

import_structures(tpe, state.module)
if (@val).global {
(@(@state).module).imported.add((@val).assembly_name)
Expand Down Expand Up @@ -6582,6 +6588,10 @@ export def create_function(
function.yield_index = 1
}

if is_closure {
add_type_meta(reference(function.state), state)
}

import_structures(tpe, state.module)
state.module.imported.add(tpe.type_name)
create_debug_info(node, function, tpe, state)
Expand Down
3 changes: 2 additions & 1 deletion src/toolchain.pr
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,10 @@ export def compile_main_file(filename: &string) {
create_types_main()

main_module_file = filename
var module = consteval_file(filename, "main", display_name = main_file_name)
var module = create_module_if_absent(filename, "main", display_name = main_file_name)
if not module { exit(1) }

consteval_module(module, main_file_name)
serialize::dependency_pass(module)

typecheck_module(module)
Expand Down

0 comments on commit 354c68c

Please sign in to comment.