internal static bool TryCreateItemValue <ItemT>( PType <ItemT> itemType, string json, GreenJsonListSyntax jsonListSyntax, int itemIndex, int listSyntaxStartPosition, List <JsonErrorInfo> errors, out ItemT convertedTargetValue, out PValue value) { GreenJsonValueSyntax itemNode = jsonListSyntax.ListItemNodes[itemIndex].ValueNode.ContentNode; int itemNodeStart = listSyntaxStartPosition + jsonListSyntax.GetElementNodeStart(itemIndex) + jsonListSyntax.ListItemNodes[itemIndex].ValueNode.BackgroundBefore.Length; var itemValueOrError = itemType.TryCreateValue( json, itemNode, out convertedTargetValue, itemNodeStart, errors); if (itemValueOrError.IsOption2(out value)) { return(true); } // Report type error at this index. itemValueOrError.IsOption1(out ITypeErrorBuilder itemTypeError); errors.Add(ValueTypeErrorAtItemIndex.Create(itemTypeError, itemIndex, itemNode, json, itemNodeStart)); return(false); }
internal static bool TryCreateTupleValue <ItemT>( PType <ItemT> itemType, string json, GreenJsonListSyntax jsonListSyntax, int itemIndex, int errorReportingOffset, List <JsonErrorInfo> errors, out ItemT convertedTargetValue, out PValue value) { if (itemIndex < jsonListSyntax.FilteredListItemNodeCount) { return(TryCreateItemValue( itemType, json, jsonListSyntax, itemIndex, errorReportingOffset, errors, out convertedTargetValue, out value)); } convertedTargetValue = default; value = default; return(false); }
internal abstract Union <ITypeErrorBuilder, PList> TryCreateFromList( string json, GreenJsonListSyntax jsonListSyntax, out T convertedValue, int listSyntaxStartPosition, List <JsonErrorInfo> errors);