fix(cold-eval): hoist make_synth_error_at out of the synth-only guard (firmware profile uses it for sink sugar)

This commit is contained in:
w1n5t0n 2026-08-18 13:34:22 +03:00
parent e1a2e0115c
commit 120eb0bb45

View file

@ -1111,6 +1111,31 @@ static EvalResult do_nudge_time(TokenStream& ts, EngineState& state) {
return make_ok();
}
// Generic positioned-error constructor (used by synth declarations AND the
// vector-packed sink sugar — must compile under every build profile).
static EvalResult make_synth_error_at(uint16_t span_start, uint16_t span_len,
DiagnosticCategory cat,
const char* message,
const char* suggestion = nullptr) {
EvalResult r;
r.kind = EvalResult::Error;
if (r.diagnostic_count < 8) {
r.diagnostics[r.diagnostic_count++] = {
DiagnosticSeverity::Error, cat,
span_start, span_len, message, suggestion
};
}
return r;
}
static EvalResult make_synth_error_at(const Token& tok,
DiagnosticCategory cat,
const char* message,
const char* suggestion = nullptr) {
return make_synth_error_at(tok.span_start, tok.span_len, cat,
message, suggestion);
}
#if USEQ_HAS_SYNTH_ENGINE
// ── Host synth declaration (synth-nodes.md §3) ─────────────────────────────
//
@ -1151,29 +1176,6 @@ static const char* strdup_safe(const char* s) {
return slot;
}
static EvalResult make_synth_error_at(uint16_t span_start, uint16_t span_len,
DiagnosticCategory cat,
const char* message,
const char* suggestion = nullptr) {
EvalResult r;
r.kind = EvalResult::Error;
if (r.diagnostic_count < 8) {
r.diagnostics[r.diagnostic_count++] = {
DiagnosticSeverity::Error, cat,
span_start, span_len, message, suggestion
};
}
return r;
}
static EvalResult make_synth_error_at(const Token& tok,
DiagnosticCategory cat,
const char* message,
const char* suggestion = nullptr) {
return make_synth_error_at(tok.span_start, tok.span_len, cat,
message, suggestion);
}
// Resolve a NodeDef by name+version, with precise diagnostics for each
// failure mode (VAL-COMP-005).
static const NodeDefDescriptor* resolve_nodedef(