From 8da352fffef39fd3f7b3082ee3096126792ea507 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 18 Oct 2026 18:23:41 +0000 Subject: [PATCH] Let a synchronous node take its SourceId with #[source_id] --- node-graph/node-macro/src/parsing.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node-graph/node-macro/src/parsing.rs b/node-graph/node-macro/src/parsing.rs index 069a33641b..193a03ebb3 100644 --- a/node-graph/node-macro/src/parsing.rs +++ b/node-graph/node-macro/src/parsing.rs @@ -918,10 +918,15 @@ fn parse_field(pat_ident: PatIdent, ty: Type, attrs: &[Attribute]) -> syn::Resul )); } + // `#[source_id]` injects the node's `SourceId` as async nodes get it, so a synchronous node can bump its own generation + let source_id = extract_attribute(attrs, "source_id").is_some(); + let value_source = match (default_value, scope) { (Some(_), Some(_)) => return Err(Error::new_spanned(&pat_ident, "Cannot have both `default` and `scope` attributes")), + (Some(_), _) | (_, Some(_)) if source_id => return Err(Error::new_spanned(&pat_ident, "`source_id` cannot have a `default` or `scope` attribute")), (Some(default_value), _) => ParsedValueSource::Default(default_value), (_, Some(scope)) => ParsedValueSource::Scope(Box::new(scope)), + _ if source_id => ParsedValueSource::SourceId, _ => ParsedValueSource::None, };