Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visitor fixes #4217

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ internal virtual void Visit(OutputLibrary library)

protected internal virtual TypeProvider? Visit(InputModelType model, TypeProvider? type)
{
return new ModelProvider(model);
return type;
}

protected internal virtual PropertyProvider? Visit(InputModelProperty property, PropertyProvider? propertyProvider)
{
return new PropertyProvider(property);
return propertyProvider;
}

protected internal virtual TypeProvider? Visit(InputEnumType enumType, TypeProvider? type)
{
return EnumProvider.Create(enumType, type);
return type;
}

protected virtual TypeProvider? Visit(TypeProvider type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ internal CSharpType CreatePrimitiveCSharpType(InputType inputType)
}
foreach (var visitor in Visitors)
{
type = visitor.Visit(enumType, declaringType);
type = visitor.Visit(enumType, type);
}
return type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void PreVisitsEnum()

_mockVisitor.Protected().Verify<TypeProvider>("Visit", Times.Once(), inputModel, ItExpr.Is<ModelProvider>(m => m.Name == new ModelProvider(inputModel).Name));

_mockVisitor.Protected().Verify<TypeProvider>("Visit", Times.Once(), inputEnum, ItExpr.IsNull<EnumProvider>());
_mockVisitor.Protected().Verify<TypeProvider>("Visit", Times.Once(), inputEnum, ItExpr.Is<EnumProvider>(m => m.Name == EnumProvider.Create(inputEnum, null).Name));
}

[Test]
Expand Down Expand Up @@ -154,7 +154,7 @@ public PreVisitor(bool cleanupReference = false)
{
return null;
}
return base.Visit(inputModelProperty, propertyProvider);
return new PropertyProvider(inputModelProperty);
}
}
}
Expand Down
Loading