Skip to content

Commit

Permalink
Некоторые замечания Сонара
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilBeaver committed Oct 6, 2023
1 parent f1e6290 commit c030fd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/OneScript.Core/Commons/IndexedNameValueCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions src/OneScript.Language/IdentifiersTrie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 4 additions & 10 deletions src/OneScript.StandardLibrary/Xml/XmlGlobalFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit c030fd4

Please sign in to comment.