@@ -515,7 +515,7 @@ static bool BeginParse(string inputString, int offset, ref int endOffset, JSONOb
515
515
// ReSharper restore UseNameofExpression
516
516
517
517
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 ) {
519
519
if ( ! BeginParse ( inputString , offset , ref endOffset , container , maxDepth , storeExcessLevels ) )
520
520
return ;
521
521
@@ -552,8 +552,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
552
552
}
553
553
554
554
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 ) ;
557
556
558
557
break ;
559
558
case '[' :
@@ -572,7 +571,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
572
571
}
573
572
574
573
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 ) ;
576
575
577
576
break ;
578
577
case '}' :
@@ -589,7 +588,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
589
588
ParseQuote ( ref openQuote , offset , ref quoteStart , ref quoteEnd ) ;
590
589
break ;
591
590
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 ) )
593
592
return ;
594
593
595
594
break ;
@@ -605,7 +604,7 @@ static void Parse(string inputString, ref int offset, int endOffset, JSONObject
605
604
}
606
605
607
606
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 ) {
609
608
if ( ! BeginParse ( inputString , offset , ref endOffset , container , maxDepth , storeExcessLevels ) )
610
609
yield break ;
611
610
@@ -635,7 +634,6 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
635
634
if ( openQuote )
636
635
break ;
637
636
638
- isField = false ;
639
637
if ( maxDepth >= 0 && depth >= maxDepth ) {
640
638
bakeDepth ++ ;
641
639
break ;
@@ -648,8 +646,7 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
648
646
}
649
647
650
648
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 ) ) {
653
650
if ( e . pause )
654
651
yield return e ;
655
652
@@ -673,7 +670,7 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
673
670
}
674
671
675
672
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 ) ) {
677
674
if ( e . pause )
678
675
yield return e ;
679
676
@@ -699,7 +696,7 @@ static IEnumerable<ParseResult> ParseAsync(string inputString, int offset, int e
699
696
ParseQuote ( ref openQuote , offset , ref quoteStart , ref quoteEnd ) ;
700
697
break ;
701
698
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 ) ) {
703
700
yield return new ParseResult ( container , offset , false ) ;
704
701
yield break ;
705
702
}
@@ -887,7 +884,7 @@ static void ParseQuote(ref bool openQuote, int offset, ref int quoteStart, ref i
887
884
}
888
885
}
889
886
890
- static bool ParseColon ( string inputString , bool openQuote , ref bool isField , JSONObject container ,
887
+ static bool ParseColon ( string inputString , bool openQuote , JSONObject container ,
891
888
ref int startOffset , int offset , int quoteStart , int quoteEnd , int bakeDepth ) {
892
889
if ( openQuote || bakeDepth > 0 )
893
890
return true ;
@@ -905,7 +902,6 @@ static bool ParseColon(string inputString, bool openQuote, ref bool isField, JSO
905
902
906
903
container . keys . Add ( inputString . Substring ( quoteStart , quoteEnd - quoteStart ) ) ;
907
904
startOffset = offset ;
908
- isField = false ;
909
905
910
906
return true ;
911
907
}
0 commit comments