Skip to content

Commit b133588

Browse files
committed
Refactor binding properties in SlangNamedTypeBinding and SlangParameter
Updated `SlangNamedTypeBinding` and `SlangParameter` classes to replace single `Binding` properties with arrays of `Bindings`. Constructors now check for a "bindings" key in the JSON object to support multiple binding points. Summary comments were also updated to reflect these changes, clarifying the new structure's capability to represent multiple bindings.
1 parent 4084486 commit b133588

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Slangc.NET/Models/SlangNamedTypeBinding.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class SlangNamedTypeBinding
1414
internal SlangNamedTypeBinding(JsonObject reader)
1515
{
1616
Name = reader["name"].Deserialize<string>();
17-
Binding = new(reader["binding"]!.AsObject());
17+
Bindings = reader.ContainsKey("bindings") ? [.. reader["bindings"]!.AsArray().Select(static reader => new SlangBinding(reader!.AsObject()))] : [new(reader["binding"]!.AsObject())];
1818
}
1919

2020
/// <summary>
@@ -23,7 +23,7 @@ internal SlangNamedTypeBinding(JsonObject reader)
2323
public string Name { get; }
2424

2525
/// <summary>
26-
/// Gets the binding information for this named type.
26+
/// Gets the array of binding points for this named type, if it spans multiple bindings (e.g., arrays of resources).
2727
/// </summary>
28-
public SlangBinding Binding { get; }
28+
public SlangBinding[] Bindings { get; }
2929
}

Slangc.NET/Models/SlangParameter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal SlangParameter(JsonObject reader)
1515
{
1616
Name = reader["name"].Deserialize<string>();
1717
UserAttributes = reader.ContainsKey("userAttribs") ? [.. reader["userAttribs"]!.AsArray().Select(static reader => new SlangUserAttribute(reader!.AsObject()))] : [];
18-
Binding = new(reader["binding"]!.AsObject());
18+
Bindings = reader.ContainsKey("bindings") ? [.. reader["bindings"]!.AsArray().Select(static reader => new SlangBinding(reader!.AsObject()))] : [new(reader["binding"]!.AsObject())];
1919
Type = new(reader["type"]!.AsObject());
2020
}
2121

@@ -30,9 +30,9 @@ internal SlangParameter(JsonObject reader)
3030
public SlangUserAttribute[] UserAttributes { get; }
3131

3232
/// <summary>
33-
/// Gets the binding information for this parameter, including binding set and register numbers.
33+
/// Gets the array of binding points for this parameter, if it spans multiple bindings (e.g., arrays of resources).
3434
/// </summary>
35-
public SlangBinding Binding { get; }
35+
public SlangBinding[] Bindings { get; }
3636

3737
/// <summary>
3838
/// Gets the type information for this parameter, including its structure and properties.

0 commit comments

Comments
 (0)