From bf2097750e03c6c05dba617b25bc952b6d9e2112 Mon Sep 17 00:00:00 2001 From: Marco Visser Date: Wed, 6 Dec 2023 16:53:30 +0100 Subject: [PATCH] Making IScopedNode internal --- .../ElementModel/ElementNodeExtensions.cs | 2 +- src/Hl7.Fhir.Base/ElementModel/IScopedNode.cs | 2 +- .../ElementModel/IScopedNodeExtensions.cs | 3 +-- src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs | 7 +++++-- .../ElementModel/TypedElementParseExtensions.cs | 12 ++++++------ src/Hl7.Fhir.Base/Properties/AssemblyInfo.cs | 10 ++++++++++ 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/Hl7.Fhir.Base/ElementModel/ElementNodeExtensions.cs b/src/Hl7.Fhir.Base/ElementModel/ElementNodeExtensions.cs index 6df5f749d2..b228dcfb62 100644 --- a/src/Hl7.Fhir.Base/ElementModel/ElementNodeExtensions.cs +++ b/src/Hl7.Fhir.Base/ElementModel/ElementNodeExtensions.cs @@ -114,7 +114,7 @@ public static ScopedNode ToScopedNode(this ITypedElement node) => /// /// An /// - public static IScopedNode AsScopedNode(this ITypedElement node) => ToScopedNode(node); + internal static IScopedNode AsScopedNode(this ITypedElement node) => ToScopedNode(node); } } diff --git a/src/Hl7.Fhir.Base/ElementModel/IScopedNode.cs b/src/Hl7.Fhir.Base/ElementModel/IScopedNode.cs index b32efeb6b1..fdd8fab486 100644 --- a/src/Hl7.Fhir.Base/ElementModel/IScopedNode.cs +++ b/src/Hl7.Fhir.Base/ElementModel/IScopedNode.cs @@ -18,7 +18,7 @@ namespace Hl7.Fhir.ElementModel /// the instance or derived from fully aware of the FHIR definitions and types /// #pragma warning disable CS0618 // Type or member is obsolete - public interface IScopedNode : IBaseElementNavigator + internal interface IScopedNode : IBaseElementNavigator #pragma warning restore CS0618 // Type or member is obsolete { /// diff --git a/src/Hl7.Fhir.Base/ElementModel/IScopedNodeExtensions.cs b/src/Hl7.Fhir.Base/ElementModel/IScopedNodeExtensions.cs index 6b628b7b5c..09fa7e6641 100644 --- a/src/Hl7.Fhir.Base/ElementModel/IScopedNodeExtensions.cs +++ b/src/Hl7.Fhir.Base/ElementModel/IScopedNodeExtensions.cs @@ -15,7 +15,7 @@ namespace Hl7.Fhir.ElementModel { - public static class IScopedNodeExtensions + internal static class IScopedNodeExtensions { /// /// Converts a to a . @@ -39,7 +39,6 @@ public static ITypedElement AsTypedElement(this IScopedNode node) => /// public static IEnumerable Children(this IEnumerable nodes, string? name = null) => nodes.SelectMany(n => n.Children(name)); - } } diff --git a/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs b/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs index dabf05cff3..6373448fa9 100644 --- a/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs +++ b/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs @@ -32,6 +32,7 @@ private class Cache private readonly Cache _cache = new(); public readonly ITypedElement Current; + private readonly ScopedNode? _parent; public ScopedNode(ITypedElement wrapped, string? instanceUri = null) { @@ -45,7 +46,7 @@ public ScopedNode(ITypedElement wrapped, string? instanceUri = null) private ScopedNode(ScopedNode parentNode, ScopedNode? parentResource, ITypedElement wrapped, string? fullUrl) { Current = wrapped; - Parent = parentNode; + _parent = parentNode; ExceptionHandler = parentNode.ExceptionHandler; ParentResource = parentNode.AtResource ? parentNode : parentResource; @@ -230,7 +231,9 @@ private set } /// - public IScopedNode? Parent { get; private set; } + + + IScopedNode? IScopedNode.Parent => _parent; /// public IEnumerable Annotations(Type type) => type == typeof(ScopedNode) ? (new[] { this }) : Current.Annotations(type); diff --git a/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs b/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs index 697a3cf5d9..495c2ef9ef 100644 --- a/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs +++ b/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs @@ -50,7 +50,7 @@ public static class TypedElementParseExtensions /// 'string' => code /// 'uri' => code /// - public static Element ParseBindable(this IScopedNode instance) => instance.parseBindable(); + internal static Element ParseBindable(this IScopedNode instance) => instance.parseBindable(); #pragma warning disable CS0618 // Type or member is obsolete private static Element parseBindable(this IBaseElementNavigator instance) where T : IBaseElementNavigator @@ -87,7 +87,7 @@ Element parseExtension() #region ParseQuantity public static Model.Quantity ParseQuantity(this ITypedElement instance) => parseQuantity(instance); - public static Model.Quantity ParseQuantity(this IScopedNode instance) => parseQuantity(instance); + internal static Model.Quantity ParseQuantity(this IScopedNode instance) => parseQuantity(instance); #pragma warning disable CS0618 // Type or member is obsolete private static Quantity parseQuantity(this IBaseElementNavigator instance) where T : IBaseElementNavigator @@ -113,7 +113,7 @@ private static Quantity parseQuantity(this IBaseElementNavigator instance) public static T ParsePrimitive(this ITypedElement instance) where T : PrimitiveType, new() => parsePrimitive(instance); - public static T ParsePrimitive(this IScopedNode instance) where T : PrimitiveType, new() + internal static T ParsePrimitive(this IScopedNode instance) where T : PrimitiveType, new() => parsePrimitive(instance); #pragma warning disable CS0618 // Type or member is obsolete @@ -126,7 +126,7 @@ private static Quantity parseQuantity(this IBaseElementNavigator instance) #region ParseCoding public static Coding ParseCoding(this ITypedElement instance) => parseCoding(instance); - public static Coding ParseCoding(this IScopedNode instance) => parseCoding(instance); + internal static Coding ParseCoding(this IScopedNode instance) => parseCoding(instance); #pragma warning disable CS0618 // Type or member is obsolete private static Coding parseCoding(this IBaseElementNavigator instance) where T : IBaseElementNavigator @@ -146,7 +146,7 @@ private static Coding parseCoding(this IBaseElementNavigator instance) whe #region ParseResourceReference public static ResourceReference ParseResourceReference(this ITypedElement instance) => instance.parseResourceReference(); - public static ResourceReference ParseResourceReference(this IScopedNode instance) => instance.parseResourceReference(); + internal static ResourceReference ParseResourceReference(this IScopedNode instance) => instance.parseResourceReference(); #pragma warning disable CS0618 // Type or member is obsolete private static ResourceReference parseResourceReference(this IBaseElementNavigator instance) where T : IBaseElementNavigator @@ -162,7 +162,7 @@ private static ResourceReference parseResourceReference(this IBaseElementNavi #region ParseCodeableConcept public static CodeableConcept ParseCodeableConcept(this ITypedElement instance) => instance.parseCodeableConcept(); - public static CodeableConcept ParseCodeableConcept(this IScopedNode instance) => instance.parseCodeableConcept(); + internal static CodeableConcept ParseCodeableConcept(this IScopedNode instance) => instance.parseCodeableConcept(); #pragma warning disable CS0618 // Type or member is obsolete private static CodeableConcept parseCodeableConcept(this IBaseElementNavigator instance) where T : IBaseElementNavigator #pragma warning restore CS0618 // Type or member is obsolete diff --git a/src/Hl7.Fhir.Base/Properties/AssemblyInfo.cs b/src/Hl7.Fhir.Base/Properties/AssemblyInfo.cs index 744c396e65..058fc3bb78 100644 --- a/src/Hl7.Fhir.Base/Properties/AssemblyInfo.cs +++ b/src/Hl7.Fhir.Base/Properties/AssemblyInfo.cs @@ -33,6 +33,11 @@ [assembly: InternalsVisibleTo("Hl7.FhirPath.R4.Tests")] [assembly: InternalsVisibleTo("Hl7.Fhir.Support.Tests")] [assembly: InternalsVisibleTo("Hl7.Fhir.Support.Poco.Tests")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Tests")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Compilation.STU3.Tests")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Compilation.R4.Tests")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Compilation.R5.Tests")] #endif #if RELEASE @@ -60,4 +65,9 @@ [assembly: InternalsVisibleTo("Hl7.FhirPath.R4.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001717d77343870eca52515a2ff9ba7ef2ff314f2f1e651f4a069401e35193d4d5124b33379a6380d510239044f012f720d395064192157eae8f67b3e4d524b79daadebd4e65ce67db327949b77bf26ca6c0f97c4ca1a578811202a537e4d112fffb2e42e852afdd71c3295c694911cdf0535f709b72ba172c40a2b1f2b607ffdc")] [assembly: InternalsVisibleTo("Hl7.Fhir.Support.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001717d77343870eca52515a2ff9ba7ef2ff314f2f1e651f4a069401e35193d4d5124b33379a6380d510239044f012f720d395064192157eae8f67b3e4d524b79daadebd4e65ce67db327949b77bf26ca6c0f97c4ca1a578811202a537e4d112fffb2e42e852afdd71c3295c694911cdf0535f709b72ba172c40a2b1f2b607ffdc")] [assembly: InternalsVisibleTo("Hl7.Fhir.Support.Poco.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001717d77343870eca52515a2ff9ba7ef2ff314f2f1e651f4a069401e35193d4d5124b33379a6380d510239044f012f720d395064192157eae8f67b3e4d524b79daadebd4e65ce67db327949b77bf26ca6c0f97c4ca1a578811202a537e4d112fffb2e42e852afdd71c3295c694911cdf0535f709b72ba172c40a2b1f2b607ffdc")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c11eea5df3095844b027f018b356bc326a5a30b1f245010ad789589aa685569b2eb7f5f2ea5c49dafed338e3d9969eab21848c6c20a6b0a22c5ff7797d9a5062d7f3e42478e905d72a3dde344086a003f2df9deeb838e206d92c8cc59150c3151e9490381321f77a716e0a2b24a585b302ba2b3db37966a3da9abe4c601ba4c1")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c11eea5df3095844b027f018b356bc326a5a30b1f245010ad789589aa685569b2eb7f5f2ea5c49dafed338e3d9969eab21848c6c20a6b0a22c5ff7797d9a5062d7f3e42478e905d72a3dde344086a003f2df9deeb838e206d92c8cc59150c3151e9490381321f77a716e0a2b24a585b302ba2b3db37966a3da9abe4c601ba4c1")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Compilation.STU3.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c11eea5df3095844b027f018b356bc326a5a30b1f245010ad789589aa685569b2eb7f5f2ea5c49dafed338e3d9969eab21848c6c20a6b0a22c5ff7797d9a5062d7f3e42478e905d72a3dde344086a003f2df9deeb838e206d92c8cc59150c3151e9490381321f77a716e0a2b24a585b302ba2b3db37966a3da9abe4c601ba4c1")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Compilation.R4.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c11eea5df3095844b027f018b356bc326a5a30b1f245010ad789589aa685569b2eb7f5f2ea5c49dafed338e3d9969eab21848c6c20a6b0a22c5ff7797d9a5062d7f3e42478e905d72a3dde344086a003f2df9deeb838e206d92c8cc59150c3151e9490381321f77a716e0a2b24a585b302ba2b3db37966a3da9abe4c601ba4c1")] +[assembly: InternalsVisibleTo("Firely.Fhir.Validation.Compilation.R5.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c11eea5df3095844b027f018b356bc326a5a30b1f245010ad789589aa685569b2eb7f5f2ea5c49dafed338e3d9969eab21848c6c20a6b0a22c5ff7797d9a5062d7f3e42478e905d72a3dde344086a003f2df9deeb838e206d92c8cc59150c3151e9490381321f77a716e0a2b24a585b302ba2b3db37966a3da9abe4c601ba4c1")] #endif