Run queries that only match singletons

wip/source-generators
copygirl 12 months ago
parent 982741a364
commit ef64ba4e08
  1. 5
      src/gaemstone.SourceGen/ModuleGenerator.cs

@ -321,7 +321,10 @@ public class ModuleGenerator
.Append(param.IsNullable ? "iter.FieldOrEmpty" : "iter.Field")
.AppendLine($"<{param.FieldType!.GetFullName()}>({param.TermIndex});");
sb.AppendLine("\t\t\tfor (var i = 0; i < iter.Count; i++) {");
// When the shim method is called, there's guaranteed to be at least one match.
// iter.Count may be 0 when there's no variable entities that can be matched.
// For example for a query that only matches singleton entities.
sb.AppendLine("\t\t\tfor (var i = 0; i == 0 || i < iter.Count; i++) {");
sb.Append($"\t\t\t\t{method.Name}");
if (method.IsGeneric) sb.Append("<T>");

Loading…
Cancel
Save