From 0ab97319c7e2d6da9310647d5da3ea7ef5ffc6ae Mon Sep 17 00:00:00 2001 From: caran Date: Wed, 29 May 2024 12:52:54 +0200 Subject: [PATCH] Local augments working --- YangParser/SemanticModel/Augment.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/YangParser/SemanticModel/Augment.cs b/YangParser/SemanticModel/Augment.cs index 411346a..b8f8a8d 100644 --- a/YangParser/SemanticModel/Augment.cs +++ b/YangParser/SemanticModel/Augment.cs @@ -73,14 +73,9 @@ public void Inject() } } - if (Argument.StartsWith("/")) - { - top = GetModule(components); - } - else - { - throw new SemanticError("TODO: Uses/Augment", Source); - } + top = Argument.StartsWith("/") ? GetModule(components) : Parent!; + + Parent?.Replace(this,[]); var target = GetTarget(top, components, sourceNS); @@ -148,7 +143,8 @@ private IStatement GetTarget(IStatement top, string[] components, string sourceN case Notification: break; default: - throw new SemanticError($"Augment target was disallowed type {current.GetType().Name}", Source); + throw new SemanticError($"Augment target '{Argument}' was disallowed type " + + $"'{current.GetType().Name} {current.Argument}'", Source); } return current;