Skip to content

Commit

Permalink
Code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Armanbqt committed Jan 10, 2020
1 parent 5aabb4b commit 8288ecc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 6 additions & 8 deletions IonDotnet/Internals/Tree/SystemTreeReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace IonDotnet.Internals.Tree
{
internal class SystemTreeReader : IIonReader
{

protected readonly IIonValue _value;
protected readonly ISymbolTable _systemSymbols;
protected IEnumerator<IIonValue> _iter;
protected IIonValue _parent;
Expand Down Expand Up @@ -119,7 +117,7 @@ public IEnumerable<SymbolToken> GetTypeAnnotations()

public int IntValue()
{
return _next.IntValue;
return _current.IntValue;
}

public long LongValue()
Expand Down Expand Up @@ -168,13 +166,13 @@ private bool IsContainer()

private void Push()
{
int oldlen = _stack.Length;
if (_top + 1 >= oldlen)
int oldLen = _stack.Length;
if (_top + 1 >= oldLen)
{
// we're going to do a "+2" on top so we need extra space
int newlen = oldlen * 2;
Object[] temp = new Object[newlen];
Array.Copy(_stack, 0, temp, 0, oldlen);
int newLen = oldLen * 2;
Object[] temp = new Object[newLen];
Array.Copy(_stack, 0, temp, 0, oldLen);
_stack = temp;
}
_stack[_top++] = _parent;
Expand Down
6 changes: 3 additions & 3 deletions IonDotnet/Internals/Tree/UserTreeReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ namespace IonDotnet.Internals.Tree
internal class UserTreeReader : SystemTreeReader
{
/// The ID of system symbol {@value #ION_1_0}, as defined by Ion 1.0.
public static readonly int ION_1_0_SID = 2;
private const int ION_1_0_SID = 2;
private readonly ICatalog _catalog;
private ISymbolTable _currentSymtab;
private int _symbol_table_top = 0;
private ISymbolTable[] _symbol_table_stack = new ISymbolTable[3]; // 3 is rare, IVM followed by a local sym tab with open content

public UserTreeReader(IIonValue value, ICatalog catalog) : base(value)
{
Expand Down Expand Up @@ -101,8 +103,6 @@ bool NextHelperUser()
return (next_type != IonType.Null);
}

private int _symbol_table_top = 0;
private ISymbolTable[] _symbol_table_stack = new ISymbolTable[3]; // 3 is rare, IVM followed by a local sym tab with open content
private void ClearSystemValueStack()
{
while (_symbol_table_top > 0)
Expand Down

0 comments on commit 8288ecc

Please sign in to comment.