Skip to content

Commit

Permalink
fix: opcode regression
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmd5 committed Feb 6, 2024
1 parent 61b1930 commit 34faddd
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Core/Meta/BebopSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public List<SpanException> Validate()
if (definition is FieldsDefinition fd)
{
var fieldDefinitionDecorators = fd.Decorators;
if (fieldDefinitionDecorators.Count is not 0)
if (fieldDefinitionDecorators.Count is > 0)
{
errors.AddRange(ValidateDefinitionDecorators(fieldDefinitionDecorators, fd));
}
Expand All @@ -241,7 +241,7 @@ public List<SpanException> Validate()
foreach (var field in fd.Fields)
{
var fieldDecorators = field.Decorators;
if (fieldDecorators.Count is not 0)
if (fieldDecorators.Count is > 0)
{
errors.AddRange(ValidateFieldDecorators(fieldDecorators, field, fd));
}
Expand Down Expand Up @@ -292,7 +292,7 @@ public List<SpanException> Validate()
if (definition is ServiceDefinition sd)
{
var serviceDecorators = sd.Decorators;
if (serviceDecorators.Count is not 0)
if (serviceDecorators.Count is > 0)
{
errors.AddRange(ValidateDefinitionDecorators(serviceDecorators, sd));
}
Expand All @@ -307,7 +307,7 @@ public List<SpanException> Validate()

var fnd = b.Definition;
var methodDecorators = b.Decorators;
if (methodDecorators.Count is not 0)
if (methodDecorators.Count is > 0)
{
errors.AddRange(ValidateDefinitionDecorators(methodDecorators, fnd));
}
Expand Down Expand Up @@ -337,7 +337,7 @@ public List<SpanException> Validate()
if (definition is EnumDefinition ed)
{
var enumDecorators = ed.Decorators;
if (enumDecorators.Count is not 0)
if (enumDecorators.Count is > 0)
{
errors.AddRange(ValidateDefinitionDecorators(enumDecorators, ed));
}
Expand All @@ -351,7 +351,7 @@ public List<SpanException> Validate()
{

var fieldDecorators = field.Decorators;
if (fieldDecorators.Count is not 0)
if (fieldDecorators.Count is > 0)
{
errors.AddRange(ValidateFieldDecorators(fieldDecorators, field, ed));
}
Expand Down Expand Up @@ -380,6 +380,18 @@ public List<SpanException> Validate()
names.Add(field.Name);
}
}
if (definition is UnionDefinition ud)
{
var unionDecorators = ud.Decorators;
if (unionDecorators.Count is > 0)
{
errors.AddRange(ValidateDefinitionDecorators(unionDecorators, ud));
}
if (ud.Branches.Count > byte.MaxValue)
{
errors.Add(new StackSizeExceededException("A union cannot have more than 255 members", ud.Span));
}
}
}
var methodIds = new Dictionary<uint, (string serviceName, string methodName)>();

Expand Down

0 comments on commit 34faddd

Please sign in to comment.