Skip to content

Commit

Permalink
Merge pull request #48 from martindevans/source_gen_protected_names
Browse files Browse the repository at this point in the history
Source Gen Special Names
  • Loading branch information
genaray authored Nov 14, 2023
2 parents 7c82480 + 200f49b commit 2a97f63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Arch.System.SourceGenerator/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static StringBuilder GetFirstElements(this StringBuilder sb, IEnumerable<

foreach (var symbol in parameterSymbols)
if(symbol.Type.Name is not "Entity" || !symbol.GetAttributes().Any(data => data.AttributeClass.Name.Contains("Data"))) // Prevent entity being added to the type array
sb.AppendLine($"ref var {symbol.Type.Name.ToLower()}FirstElement = ref chunk.GetFirst<{symbol.Type.ToDisplayString(NullableFlowState.None, SymbolDisplayFormat.FullyQualifiedFormat)}>();");
sb.AppendLine($"ref var @{symbol.Type.Name.ToLower()}FirstElement = ref chunk.GetFirst<{symbol.Type.ToDisplayString(NullableFlowState.None, SymbolDisplayFormat.FullyQualifiedFormat)}>();");

return sb;
}
Expand All @@ -35,7 +35,7 @@ public static StringBuilder GetComponents(this StringBuilder sb, IEnumerable<IPa
{
foreach (var symbol in parameterSymbols)
if(symbol.Type.Name is not "Entity") // Prevent entity being added to the type array
sb.AppendLine($"ref var {symbol.Name.ToLower()} = ref Unsafe.Add(ref {symbol.Type.Name.ToLower()}FirstElement, entityIndex);");
sb.AppendLine($"ref var @{symbol.Name.ToLower()} = ref Unsafe.Add(ref {symbol.Type.Name.ToLower()}FirstElement, entityIndex);");

return sb;
}
Expand All @@ -50,7 +50,7 @@ public static StringBuilder GetComponents(this StringBuilder sb, IEnumerable<IPa
public static StringBuilder InsertParams(this StringBuilder sb, IEnumerable<IParameterSymbol> parameterSymbols)
{
foreach (var symbol in parameterSymbols)
sb.Append($"{CommonUtils.RefKindToString(symbol.RefKind)} {symbol.Name.ToLower()},");
sb.Append($"{CommonUtils.RefKindToString(symbol.RefKind)} @{symbol.Name.ToLower()},");

if(sb.Length > 0) sb.Length--;
return sb;
Expand Down Expand Up @@ -96,7 +96,7 @@ public static StringBuilder DataParameters(this StringBuilder sb, IEnumerable<IP
foreach (var parameter in parameterSymbols)
{
if (parameter.GetAttributes().Any(attributeData => attributeData.AttributeClass.Name.Contains("Data")))
sb.Append($"{CommonUtils.RefKindToString(parameter.RefKind)} {parameter.Type} {parameter.Name.ToLower()},");
sb.Append($"{CommonUtils.RefKindToString(parameter.RefKind)} {parameter.Type} @{parameter.Name.ToLower()},");
}
sb.Length--;
return sb;
Expand Down

0 comments on commit 2a97f63

Please sign in to comment.