Added support for ref/inout parameters in static functions

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-04 23:57:48 +02:00
1 親 421ab218b6
コミット 07f7d855b3
2ファイル変更
+15 -6

検索条件に一致するファイルはありません

+13 -4
ファイルの表示
@@ -1,4 +1,9 @@
namespace ComputeSharp.Shaders.Renderer.Models.Functions
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
namespace ComputeSharp.Shaders.Renderer.Models.Functions
{
/// <summary>
/// A <see langword="class"/> that contains info on a function parameter
@@ -28,13 +33,17 @@
/// <summary>
/// Creates a new <see cref="ParameterInfo"/> instance with the specified parameters
/// </summary>
/// <param name="parameterModifier">The modifier to use for the current parameter</param>
/// <param name="parameterModifiers">The modifiers used in the current parameter</param>
/// <param name="parameterType">The type of the current parameter</param>
/// <param name="parameterName">The name of the current parameter</param>
/// <param name="last">Indicates whether or not the current parameter is the last one</param>
public ParameterInfo(string parameterModifier, string parameterType, string parameterName, bool last)
public ParameterInfo(IReadOnlyList<SyntaxToken> parameterModifiers, string parameterType, string parameterName, bool last)
{
ParameterModifier = parameterModifier;
if (parameterModifiers.Count == 0) ParameterModifier = "in";
else if (parameterModifiers.First().IsKind(SyntaxKind.OutKeyword)) ParameterModifier = "out";
else if (parameterModifiers.Any(m => m.IsKind(SyntaxKind.RefKeyword)) && !parameterModifiers.Any(m => m.IsKind(SyntaxKind.ReadOnlyKeyword))) ParameterModifier = "inout";
else ParameterModifier = "in";
ParameterType = parameterType;
ParameterName = parameterName;
IsLastParameter = last;