Skip to content

Commit a0c2d75

Browse files
committed
Remove isField argument
1 parent a567430 commit a0c2d75

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

JSONObject.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static bool BeginParse(string inputString, int offset, ref int endOffset, JSONOb
515515
// ReSharper restore UseNameofExpression
516516

517517
static void Parse(string inputString, ref int offset, int endOffset, JSONObject container, int maxDepth,
518-
bool storeExcessLevels, int depth = 0, bool isField = false, bool isRoot = true) {
518+
bool storeExcessLevels, int depth = 0, bool isRoot = true) {
519519
if (!BeginParse(inputString, offset, ref endOffset, container, maxDepth, storeExcessLevels))
520520
return;
521521

@@ -552,8 +552,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
552552
}
553553

554554
newContainer.type = Type.Object;
555-
isField = true;
556-
Parse(inputString, ref offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, isField, false);
555+
Parse(inputString, ref offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, false);
557556

558557
break;
559558
case '[':
@@ -572,7 +571,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
572571
}
573572

574573
newContainer.type = Type.Array;
575-
Parse(inputString, ref offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, isField, false);
574+
Parse(inputString, ref offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, false);
576575

577576
break;
578577
case '}':
@@ -589,7 +588,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
589588
ParseQuote(ref openQuote, offset, ref quoteStart, ref quoteEnd);
590589
break;
591590
case ':':
592-
if (!ParseColon(inputString, openQuote, ref isField, container, ref startOffset, offset, quoteStart, quoteEnd, bakeDepth))
591+
if (!ParseColon(inputString, openQuote, container, ref startOffset, offset, quoteStart, quoteEnd, bakeDepth))
593592
return;
594593

595594
break;
@@ -605,7 +604,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
605604
}
606605

607606
static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int endOffset, JSONObject container,
608-
int maxDepth, bool storeExcessLevels, int depth = 0, bool isField = false, bool isRoot = true) {
607+
int maxDepth, bool storeExcessLevels, int depth = 0, bool isRoot = true) {
609608
if (!BeginParse(inputString, offset, ref endOffset, container, maxDepth, storeExcessLevels))
610609
yield break;
611610

@@ -635,7 +634,6 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
635634
if (openQuote)
636635
break;
637636

638-
isField = false;
639637
if (maxDepth >= 0 && depth >= maxDepth) {
640638
bakeDepth++;
641639
break;
@@ -648,8 +646,7 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
648646
}
649647

650648
newContainer.type = Type.Object;
651-
isField = true;
652-
foreach (var e in ParseAsync(inputString, offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, isField, false)) {
649+
foreach (var e in ParseAsync(inputString, offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, false)) {
653650
if (e.pause)
654651
yield return e;
655652

@@ -673,7 +670,7 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
673670
}
674671

675672
newContainer.type = Type.Array;
676-
foreach (var e in ParseAsync(inputString, offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, isField, false)) {
673+
foreach (var e in ParseAsync(inputString, offset, endOffset, newContainer, maxDepth, storeExcessLevels, depth + 1, false)) {
677674
if (e.pause)
678675
yield return e;
679676

@@ -699,7 +696,7 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
699696
ParseQuote(ref openQuote, offset, ref quoteStart, ref quoteEnd);
700697
break;
701698
case ':':
702-
if (!ParseColon(inputString, openQuote, ref isField, container, ref startOffset, offset, quoteStart, quoteEnd, bakeDepth)) {
699+
if (!ParseColon(inputString, openQuote, container, ref startOffset, offset, quoteStart, quoteEnd, bakeDepth)) {
703700
yield return new ParseResult(container, offset, false);
704701
yield break;
705702
}
@@ -887,7 +884,7 @@ static void ParseQuote(ref bool openQuote, int offset, ref int quoteStart, ref i
887884
}
888885
}
889886

890-
static bool ParseColon(string inputString, bool openQuote, ref bool isField, JSONObject container,
887+
static bool ParseColon(string inputString, bool openQuote, JSONObject container,
891888
ref int startOffset,int offset, int quoteStart, int quoteEnd, int bakeDepth) {
892889
if (openQuote || bakeDepth > 0)
893890
return true;
@@ -905,7 +902,6 @@ static bool ParseColon(string inputString, bool openQuote, ref bool isField, JSO
905902

906903
container.keys.Add(inputString.Substring(quoteStart, quoteEnd - quoteStart));
907904
startOffset = offset;
908-
isField = false;
909905

910906
return true;
911907
}

0 commit comments

Comments
 (0)