Skip to content

Commit f3014db

Browse files
authored
Update cdac-build-tool to omit type when it is empty (#101825)
1 parent 38f5daf commit f3014db

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

src/coreclr/tools/cdac-build-tool/DataDescriptorModel.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ public DataDescriptorModel Build()
185185
var globals = new Dictionary<string, GlobalModel>();
186186
foreach (var (globalName, globalBuilder) in _globals)
187187
{
188-
if (globalBuilder.Type == string.Empty)
189-
{
190-
throw new InvalidOperationException($"Type must be set for global {globalName}");
191-
}
192188
GlobalValue? v = globalBuilder.Value;
193189
if (v == null)
194190
{

src/coreclr/tools/cdac-build-tool/JsonConverter/FieldModelJsonConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public override DataDescriptorModel.FieldModel Read(ref Utf8JsonReader reader, T
2020

2121
public override void Write(Utf8JsonWriter writer, DataDescriptorModel.FieldModel value, JsonSerializerOptions options)
2222
{
23-
if (value.Type is null)
23+
if (string.IsNullOrEmpty(value.Type))
2424
{
2525
writer.WriteNumberValue(value.Offset);
2626
}

src/coreclr/tools/cdac-build-tool/JsonConverter/GlobalModelJsonConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public override DataDescriptorModel.GlobalModel Read(ref Utf8JsonReader reader,
1515

1616
public override void Write(Utf8JsonWriter writer, DataDescriptorModel.GlobalModel value, JsonSerializerOptions options)
1717
{
18-
if (value.Type is null)
18+
if (string.IsNullOrEmpty(value.Type))
1919
{
2020
// no type: just write 'value' or '[value]'
2121
JsonSerializer.Serialize(writer, value.Value, options);

0 commit comments

Comments
 (0)