From c030fd402ddcd2e54846799b55bc0638edc4ed73 Mon Sep 17 00:00:00 2001 From: EvilBeaver Date: Fri, 6 Oct 2023 21:32:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=B7=D0=B0=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=A1=D0=BE=D0=BD=D0=B0=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commons/IndexedNameValueCollection.cs | 2 +- src/OneScript.Language/IdentifiersTrie.cs | 10 +++++----- .../Xml/XmlGlobalFunctions.cs | 14 ++++---------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/OneScript.Core/Commons/IndexedNameValueCollection.cs b/src/OneScript.Core/Commons/IndexedNameValueCollection.cs index 059764382..94e2631ff 100644 --- a/src/OneScript.Core/Commons/IndexedNameValueCollection.cs +++ b/src/OneScript.Core/Commons/IndexedNameValueCollection.cs @@ -58,7 +58,7 @@ public T this[string name] public void AddName(int index, string name) { if (index < 0 || index >= _values.Count) - throw new ArgumentOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(index)); _nameIndex[name] = index; } diff --git a/src/OneScript.Language/IdentifiersTrie.cs b/src/OneScript.Language/IdentifiersTrie.cs index cacf088fb..df4b68a19 100644 --- a/src/OneScript.Language/IdentifiersTrie.cs +++ b/src/OneScript.Language/IdentifiersTrie.cs @@ -74,17 +74,17 @@ public void Add(string str, T val) node.Value = val; } - public bool ContainsKey(string str) + public bool ContainsKey(string key) { var node = _root; - foreach (char ch in str) + foreach (char ch in key) { - var key = node.Find(ch); - if (key == null) + var keyNode = node.Find(ch); + if (keyNode == null) { return false; } - node = key.next; + node = keyNode.next; } return node.next == null && node.HasValue; diff --git a/src/OneScript.StandardLibrary/Xml/XmlGlobalFunctions.cs b/src/OneScript.StandardLibrary/Xml/XmlGlobalFunctions.cs index 9d75a67ed..48acbc43b 100644 --- a/src/OneScript.StandardLibrary/Xml/XmlGlobalFunctions.cs +++ b/src/OneScript.StandardLibrary/Xml/XmlGlobalFunctions.cs @@ -138,21 +138,15 @@ public IValue XMLValue(IValue givenType, string presentation) { if (presentation.Trim() == "") return ValueFactory.Create(); - else - { - throw RuntimeException.InvalidNthArgumentValue(2); - } - return ValueFactory.Create(); + + throw RuntimeException.InvalidNthArgumentValue(2); } else if (typeValue.Equals(BasicTypes.Null)) { if (presentation.Trim() == "") return ValueFactory.CreateNullValue(); - else - { - throw RuntimeException.InvalidNthArgumentValue(2); - } - return ValueFactory.Create(); + + throw RuntimeException.InvalidNthArgumentValue(2); } else if (typeValue.ImplementingClass == typeof(GuidWrapper)) {