mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Fix serialization source gen with partial types
This fixes RMC compilation
This commit is contained in:
@@ -43,7 +43,7 @@ END TEMPLATE-->
|
||||
|
||||
### Bugfixes
|
||||
|
||||
*None yet*
|
||||
* Fix serialization source generator breaking if a class has two partial locations.
|
||||
|
||||
### Other
|
||||
|
||||
|
||||
@@ -35,13 +35,20 @@ public class Generator : IIncrementalGenerator
|
||||
.Where(static type => type != null);
|
||||
|
||||
initContext.RegisterSourceOutput(
|
||||
dataDefinitions,
|
||||
static (sourceContext, source) =>
|
||||
dataDefinitions.Collect(),
|
||||
static (sourceContext, sources) =>
|
||||
{
|
||||
// TODO: deduplicate based on name?
|
||||
var (name, code) = source!.Value;
|
||||
var done = new HashSet<string>();
|
||||
|
||||
sourceContext.AddSource(name, code);
|
||||
foreach (var source in sources)
|
||||
{
|
||||
var (name, code) = source!.Value;
|
||||
|
||||
if (!done.Add(name))
|
||||
continue;
|
||||
|
||||
sourceContext.AddSource(name, code);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user