Skip to content

Commit

Permalink
feat: make all type conversions public (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajewellamz authored Nov 13, 2023
1 parent 72f7e32 commit 2b138b9
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1296,27 +1296,15 @@ protected TypeConverter buildConverterFromMethodBodies(
}
final String cSharpType = type;



// TODO It may be more stable to have _all_ converters be public.
// Right now the expectation is that a reference to a resource
// is the _only_ way to share types.
// By making them all public the surface area is increased.

// For any module that takes a dependency on this module,
// they will need to wrap and unwrap reference types.
// This is more controlled than exposing
// the NativeWrapper and the Dafny wrapped type.
// However, if this type is already exposed
// from a dependent module
// leave that as the _only_ public converter
// and this converter is internal.
final boolean isDependantModuleType = ModelUtils.isReferenceDependantModuleType(shape,
nameResolver.namespaceForService());

final String visibility = shape.hasTrait(ReferenceTrait.class) && !isDependantModuleType
? "public"
: "internal";
// Make all converters public, because most need to be and it's not worth the trouble to hide the remaining few.
final String visibility = "public";

final String fromDafnyConverterName = typeConverterForShape(id, FROM_DAFNY);
final TokenTree fromDafnyConverterSignature = TokenTree.of(
Expand Down

0 comments on commit 2b138b9

Please sign in to comment.