caller-context comptime preservation
This commit is contained in:
@@ -3491,10 +3491,19 @@ ct_eval_template_call :: proc(
|
||||
if param.comptime_value {
|
||||
continue
|
||||
}
|
||||
param_type := type_from_syntax(checker, param.type, function.pkg, function.file)
|
||||
if index >= len(args) {
|
||||
return INVALID_CT_VALUE, ct_flow(.Normal), false
|
||||
}
|
||||
append(&runtime_types, type_from_syntax(checker, param.type, function.pkg, function.file))
|
||||
append(&runtime_names, param.name)
|
||||
}
|
||||
checker.current_comptime_values = previous_comptime
|
||||
runtime_index := 0
|
||||
for param, index in function.params {
|
||||
if param.comptime_value {
|
||||
continue
|
||||
}
|
||||
param_type := runtime_types[runtime_index]
|
||||
value, flow, ok := ct_eval_expr(state, args[index], param_type, depth+1)
|
||||
if !ok || flow.kind != .Normal {
|
||||
return INVALID_CT_VALUE, flow, ok
|
||||
@@ -3510,9 +3519,9 @@ ct_eval_template_call :: proc(
|
||||
)
|
||||
}
|
||||
append(&runtime_values, value)
|
||||
append(&runtime_types, param_type)
|
||||
append(&runtime_names, param.name)
|
||||
runtime_index += 1
|
||||
}
|
||||
checker.current_comptime_values = comptime_values
|
||||
previous_pkg := state.pkg
|
||||
previous_file := state.file
|
||||
previous_result := state.result
|
||||
|
||||
Reference in New Issue
Block a user