From 7e05963cc481b74392a99ae88c6c13f596a33ebc Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:15:15 +0000 Subject: [PATCH] non-scope defs are effective (#67) fixes bevyengine/bevy#10533 shader defs used only in literal substitutions (`#MY_DEF` or `#{MY_DEF}`) were not counted towards the module's effective defs, so were not validated when looking for an existing cached version of the module. add them to effective defs. --- src/compose/preprocess.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compose/preprocess.rs b/src/compose/preprocess.rs index 133739d..869a8cb 100644 --- a/src/compose/preprocess.rs +++ b/src/compose/preprocess.rs @@ -468,6 +468,14 @@ impl Preprocessor { return Err(ComposerErrorInner::DefineInModule(offset)); } } else { + for cap in self + .def_regex + .captures_iter(&line) + .chain(self.def_regex_delimited.captures_iter(&line)) + { + effective_defs.insert(cap.get(1).unwrap().as_str().to_owned()); + } + substitute_identifiers(&line, offset, &declared_imports, &mut used_imports, true) .unwrap(); }