Skip to content

Commit c030fd4

Browse files
committed
Некоторые замечания Сонара
1 parent f1e6290 commit c030fd4

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

src/OneScript.Core/Commons/IndexedNameValueCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public T this[string name]
5858
public void AddName(int index, string name)
5959
{
6060
if (index < 0 || index >= _values.Count)
61-
throw new ArgumentOutOfRangeException();
61+
throw new ArgumentOutOfRangeException(nameof(index));
6262

6363
_nameIndex[name] = index;
6464
}

src/OneScript.Language/IdentifiersTrie.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ public void Add(string str, T val)
7474
node.Value = val;
7575
}
7676

77-
public bool ContainsKey(string str)
77+
public bool ContainsKey(string key)
7878
{
7979
var node = _root;
80-
foreach (char ch in str)
80+
foreach (char ch in key)
8181
{
82-
var key = node.Find(ch);
83-
if (key == null)
82+
var keyNode = node.Find(ch);
83+
if (keyNode == null)
8484
{
8585
return false;
8686
}
87-
node = key.next;
87+
node = keyNode.next;
8888
}
8989

9090
return node.next == null && node.HasValue;

src/OneScript.StandardLibrary/Xml/XmlGlobalFunctions.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,15 @@ public IValue XMLValue(IValue givenType, string presentation)
138138
{
139139
if (presentation.Trim() == "")
140140
return ValueFactory.Create();
141-
else
142-
{
143-
throw RuntimeException.InvalidNthArgumentValue(2);
144-
}
145-
return ValueFactory.Create();
141+
142+
throw RuntimeException.InvalidNthArgumentValue(2);
146143
}
147144
else if (typeValue.Equals(BasicTypes.Null))
148145
{
149146
if (presentation.Trim() == "")
150147
return ValueFactory.CreateNullValue();
151-
else
152-
{
153-
throw RuntimeException.InvalidNthArgumentValue(2);
154-
}
155-
return ValueFactory.Create();
148+
149+
throw RuntimeException.InvalidNthArgumentValue(2);
156150
}
157151
else if (typeValue.ImplementingClass == typeof(GuidWrapper))
158152
{

0 commit comments

Comments
 (0)