Skip to content

Commit

Permalink
Making IScopedNode internal
Browse files Browse the repository at this point in the history
  • Loading branch information
marcovisserFurore committed Dec 6, 2023
1 parent 3b86a3a commit bf20977
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Hl7.Fhir.Base/ElementModel/ElementNodeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static ScopedNode ToScopedNode(this ITypedElement node) =>
/// </summary>
/// <param name="node">An <see cref="ITypedElement"/></param>
/// <returns></returns>
public static IScopedNode AsScopedNode(this ITypedElement node) => ToScopedNode(node);
internal static IScopedNode AsScopedNode(this ITypedElement node) => ToScopedNode(node);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Hl7.Fhir.Base/ElementModel/IScopedNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Hl7.Fhir.ElementModel
/// the instance or derived from fully aware of the FHIR definitions and types
/// </remarks>
#pragma warning disable CS0618 // Type or member is obsolete
public interface IScopedNode : IBaseElementNavigator<IScopedNode>
internal interface IScopedNode : IBaseElementNavigator<IScopedNode>
#pragma warning restore CS0618 // Type or member is obsolete
{
/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/Hl7.Fhir.Base/ElementModel/IScopedNodeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Hl7.Fhir.ElementModel
{
public static class IScopedNodeExtensions
internal static class IScopedNodeExtensions
{
/// <summary>
/// Converts a <see cref="IScopedNode"/> to a <see cref="ITypedElement"/>.
Expand All @@ -39,7 +39,6 @@ public static ITypedElement AsTypedElement(this IScopedNode node) =>
/// <returns></returns>
public static IEnumerable<IScopedNode> Children(this IEnumerable<IScopedNode> nodes, string? name = null) =>
nodes.SelectMany(n => n.Children(name));

}
}

Expand Down
7 changes: 5 additions & 2 deletions src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;

Expand Down Expand Up @@ -230,7 +231,9 @@ private set
}

/// <inheritdoc />
public IScopedNode? Parent { get; private set; }


IScopedNode? IScopedNode.Parent => _parent;

/// <inheritdoc />
public IEnumerable<object> Annotations(Type type) => type == typeof(ScopedNode) ? (new[] { this }) : Current.Annotations(type);
Expand Down
12 changes: 6 additions & 6 deletions src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class TypedElementParseExtensions
/// 'string' => code
/// 'uri' => code
/// </remarks>
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<T>(this IBaseElementNavigator<T> instance) where T : IBaseElementNavigator<T>
Expand Down Expand Up @@ -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<T>(this IBaseElementNavigator<T> instance) where T : IBaseElementNavigator<T>
Expand All @@ -113,7 +113,7 @@ private static Quantity parseQuantity<T>(this IBaseElementNavigator<T> instance)
public static T ParsePrimitive<T>(this ITypedElement instance) where T : PrimitiveType, new()
=> parsePrimitive<T, ITypedElement>(instance);

public static T ParsePrimitive<T>(this IScopedNode instance) where T : PrimitiveType, new()
internal static T ParsePrimitive<T>(this IScopedNode instance) where T : PrimitiveType, new()
=> parsePrimitive<T, IScopedNode>(instance);

#pragma warning disable CS0618 // Type or member is obsolete
Expand All @@ -126,7 +126,7 @@ private static Quantity parseQuantity<T>(this IBaseElementNavigator<T> 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<T>(this IBaseElementNavigator<T> instance) where T : IBaseElementNavigator<T>
Expand All @@ -146,7 +146,7 @@ private static Coding parseCoding<T>(this IBaseElementNavigator<T> 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<T>(this IBaseElementNavigator<T> instance) where T : IBaseElementNavigator<T>
Expand All @@ -162,7 +162,7 @@ private static ResourceReference parseResourceReference<T>(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<T>(this IBaseElementNavigator<T> instance) where T : IBaseElementNavigator<T>
#pragma warning restore CS0618 // Type or member is obsolete
Expand Down
10 changes: 10 additions & 0 deletions src/Hl7.Fhir.Base/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit bf20977

Please sign in to comment.