Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed Apr 20, 2024
1 parent a1a3dc5 commit 16daf68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/consteval.pr
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export def make_value(value: compiler::Value) -> &scope::Value {
export def copy_state(state: &typechecking::State) -> &typechecking::State {
let new_state: &typechecking::State = @state
new_state.function_stack = vector::copy(state.function_stack)
new_state.context = null
return new_state
}

Expand Down
6 changes: 3 additions & 3 deletions src/scope.pr
Original file line number Diff line number Diff line change
Expand Up @@ -1712,16 +1712,16 @@ export def create_polymorph(
scope = scope.module.scope // Global scope
let module_name = module.filename

let v = create_function_value(scope, name_node, parser::ShareMarker::NONE, Phase::COMPILED, node, state, tpe, impl)
if not scope.polymorphics {
scope.polymorphics = map::make(type &Scope)
}
var poly_scope = scope.polymorphics.get_or_default(module_name, null)
if not poly_scope {
poly_scope = enter_scope(null, scope.module)
poly_scope = enter_scope(null, null)
scope.polymorphics(module_name) = poly_scope
}

scope.polymorphics(module_name) = poly_scope
let v = create_function_value(scope, name_node, parser::ShareMarker::NONE, Phase::COMPILED, node, null, tpe, impl)
return create_function(poly_scope, name_node, v, impl)
}

Expand Down

0 comments on commit 16daf68

Please sign in to comment.