Switched source generated files to only use LF line endings
このコミットが含まれているのは:
1 親
632cd6faf5
コミット
6fbcf21f74
6ファイル変更
+18
-18
検索条件に一致するファイルはありません
@@ -101,7 +101,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
var source =
|
||||
CompilationUnit().AddMembers(
|
||||
NamespaceDeclaration(IdentifierName(namespaceName)).AddMembers(typeDeclarationSyntax))
|
||||
.NormalizeWhitespace()
|
||||
.NormalizeWhitespace(eol: "\n")
|
||||
.ToFullString();
|
||||
|
||||
// Add the partial type
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
constantDefinitions,
|
||||
context);
|
||||
|
||||
string? assignment = staticFieldRewriter.Visit(variableDeclarator)?.NormalizeWhitespace().ToFullString();
|
||||
string? assignment = staticFieldRewriter.Visit(variableDeclarator)?.NormalizeWhitespace(eol: "\n").ToFullString();
|
||||
|
||||
yield return (mapping ?? fieldSymbol.Name, typeDeclaration, assignment);
|
||||
}
|
||||
@@ -350,8 +350,8 @@ namespace ComputeSharp.SourceGenerators
|
||||
// Emit the extracted local functions first
|
||||
foreach (var localFunction in shaderSourceRewriter.LocalFunctions)
|
||||
{
|
||||
methods.Add(localFunction.Value.NormalizeWhitespace().ToFullString());
|
||||
declarations.Add(localFunction.Value.AsDefinition().NormalizeWhitespace().ToFullString());
|
||||
methods.Add(localFunction.Value.NormalizeWhitespace(eol: "\n").ToFullString());
|
||||
declarations.Add(localFunction.Value.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString());
|
||||
}
|
||||
|
||||
// If the method is the shader entry point, do additional processing
|
||||
@@ -363,20 +363,20 @@ namespace ComputeSharp.SourceGenerators
|
||||
false => new ExecuteMethodRewriter.Pixel(shaderSourceRewriter).Visit(processedMethod)!
|
||||
};
|
||||
|
||||
entryPoint = processedMethod.NormalizeWhitespace().ToFullString();
|
||||
entryPoint = processedMethod.NormalizeWhitespace(eol: "\n").ToFullString();
|
||||
}
|
||||
else
|
||||
{
|
||||
methods.Add(processedMethod.NormalizeWhitespace().ToFullString());
|
||||
declarations.Add(processedMethod.AsDefinition().NormalizeWhitespace().ToFullString());
|
||||
methods.Add(processedMethod.NormalizeWhitespace(eol: "\n").ToFullString());
|
||||
declarations.Add(processedMethod.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString());
|
||||
}
|
||||
}
|
||||
|
||||
// Process static methods as well
|
||||
foreach (MethodDeclarationSyntax staticMethod in staticMethods.Values)
|
||||
{
|
||||
methods.Add(staticMethod.NormalizeWhitespace().ToFullString());
|
||||
declarations.Add(staticMethod.AsDefinition().NormalizeWhitespace().ToFullString());
|
||||
methods.Add(staticMethod.NormalizeWhitespace(eol: "\n").ToFullString());
|
||||
declarations.Add(staticMethod.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString());
|
||||
}
|
||||
|
||||
return (entryPoint!, methods, declarations, isSamplerUsed);
|
||||
@@ -431,7 +431,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
// Insert the trailing ; right after the closing bracket (after normalization)
|
||||
yield return
|
||||
structDeclaration
|
||||
.NormalizeWhitespace()
|
||||
.NormalizeWhitespace(eol: "\n")
|
||||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken))
|
||||
.ToFullString();
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
UsingDirective(IdentifierName("ComputeSharp.__Internals"))).AddMembers(
|
||||
NamespaceDeclaration(IdentifierName(namespaceName)).AddMembers(typeDeclarationSyntax)
|
||||
.WithNamespaceKeyword(Token(TriviaList(Trivia(PragmaWarningDirectiveTrivia(Token(SyntaxKind.DisableKeyword), true))), SyntaxKind.NamespaceKeyword, TriviaList())))
|
||||
.NormalizeWhitespace()
|
||||
.NormalizeWhitespace(eol: "\n")
|
||||
.ToFullString();
|
||||
|
||||
// Add the method source attribute
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
AttributeArgument(NestedArrayExpression(Array.Empty<string[]>()))))) // TODO
|
||||
.WithOpenBracketToken(Token(TriviaList(Trivia(PragmaWarningDirectiveTrivia(Token(SyntaxKind.DisableKeyword), true))), SyntaxKind.OpenBracketToken, TriviaList()))
|
||||
.WithTarget(AttributeTargetSpecifier(Token(SyntaxKind.AssemblyKeyword))))
|
||||
.NormalizeWhitespace()
|
||||
.NormalizeWhitespace(eol: "\n")
|
||||
.ToFullString();
|
||||
|
||||
// Add the method source attribute
|
||||
@@ -120,7 +120,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
.Visit(methodDeclaration)!
|
||||
.WithIdentifier(Identifier(ShaderMethodSourceAttribute.InvokeMethodIdentifier))
|
||||
.WithoutTrivia()
|
||||
.NormalizeWhitespace()
|
||||
.NormalizeWhitespace(eol: "\n")
|
||||
.ToFullString();
|
||||
|
||||
List<string> localFunctions = new(shaderSourceRewriter.LocalFunctions.Count);
|
||||
@@ -128,7 +128,7 @@ namespace ComputeSharp.SourceGenerators
|
||||
// Emit the extracted local functions
|
||||
foreach (var localFunction in shaderSourceRewriter.LocalFunctions)
|
||||
{
|
||||
localFunctions.Add(localFunction.Value.NormalizeWhitespace().ToFullString());
|
||||
localFunctions.Add(localFunction.Value.NormalizeWhitespace(eol: "\n").ToFullString());
|
||||
}
|
||||
|
||||
return (targetMethod, localFunctions);
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
ShaderSourceRewriter shaderSourceRewriter = new(SemanticModel, DiscoveredTypes, this.staticMethods, ConstantDefinitions, Context);
|
||||
MethodDeclarationSyntax
|
||||
methodNode = (MethodDeclarationSyntax)method.DeclaringSyntaxReferences[0].GetSyntax(),
|
||||
processedMethod = shaderSourceRewriter.Visit(methodNode)!.NormalizeWhitespace().WithoutTrivia();
|
||||
processedMethod = shaderSourceRewriter.Visit(methodNode)!.NormalizeWhitespace(eol: "\n").WithoutTrivia();
|
||||
|
||||
this.staticMethods.Add(method, processedMethod.WithIdentifier(Identifier(methodIdentifier)));
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
/// <param name="source">The input source to process.</param>
|
||||
/// <param name="index">The target index to check in the resulting output.</param>
|
||||
/// <param name="expectedBody">The expected body to compare with the generated code.</param>
|
||||
private void VerifyGeneratedMethodLines<TGenerator>(string source, int index, string expectedBody)
|
||||
private static void VerifyGeneratedMethodLines<TGenerator>(string source, int index, string expectedBody)
|
||||
where TGenerator : class, ISourceGenerator, new()
|
||||
{
|
||||
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(source);
|
||||
@@ -97,8 +97,8 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
string outputBody = outputCompilation.SyntaxTrees.Skip(index + 1).First().ToString();
|
||||
|
||||
string[]
|
||||
outputLines = outputBody.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries),
|
||||
expectedLines = expectedBody.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
outputLines = outputBody.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries),
|
||||
expectedLines = expectedBody.Replace("\r", "").Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
|
||||
Assert.AreEqual(expectedLines.Length, outputLines.Length);
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする