From 120eb0bb458edcc2624f8fc73a392fd90131a693 Mon Sep 17 00:00:00 2001 From: w1n5t0n Date: Tue, 18 Aug 2026 13:34:22 +0300 Subject: [PATCH] fix(cold-eval): hoist make_synth_error_at out of the synth-only guard (firmware profile uses it for sink sugar) --- src/signal_engine/cold_eval.cpp | 48 +++++++++++++++++---------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/signal_engine/cold_eval.cpp b/src/signal_engine/cold_eval.cpp index 4e4d851..c34c488 100644 --- a/src/signal_engine/cold_eval.cpp +++ b/src/signal_engine/cold_eval.cpp @@ -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(