Skip to content

Commit

Permalink
Nullable: System.Xml, part 6 (XSLT minus XSLT.Runtime) (#40368)
Browse files Browse the repository at this point in the history
* Nullable: System.Xml, part 6 (XSLT minus XSLT.Runtime)

* change Evaluate to take non-nullable

* apply pr feedback

* fix nullability merge conflicts

* apply feedback
  • Loading branch information
krwq authored Aug 15, 2020
1 parent f35d747 commit 12f8e34
Show file tree
Hide file tree
Showing 171 changed files with 2,544 additions and 2,266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override object Evaluate(XPathNodeIterator nodeIterator) =>
FT.FuncNot => Not(nodeIterator),
FT.FuncTrue => true,
FT.FuncFalse => false,
FT.FuncLang => Lang(nodeIterator),
FT.FuncLang => Lang(nodeIterator!),
_ => false,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ internal sealed class XPathComparerHelper : IComparer
private readonly CultureInfo _cinfo;
private readonly XmlDataType _dataType;

public XPathComparerHelper(XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType)
public XPathComparerHelper(XmlSortOrder order, XmlCaseOrder caseOrder, string? lang, XmlDataType dataType)
{
if (lang == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ public ContextQuery()
{
this.count = 0;
}

protected ContextQuery(ContextQuery other) : base(other)
{
this.contextNode = other.contextNode; // Don't need to clone here
}

public override void Reset()
{
count = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public override object Evaluate(XPathNodeIterator nodeIterator)
try
{
Debug.Assert(_function != null);
object? retVal = ProcessResult(_function.Invoke(xsltContext, argVals, nodeIterator.Current));
object? retVal = ProcessResult(_function.Invoke(xsltContext, argVals, nodeIterator.Current!));

// ProcessResult may return null when the input value is XmlNode and here doesn't seem to be the case.
Debug.Assert(retVal != null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private double Number(XPathNodeIterator nodeIterator)
{
if (_arg == null)
{
Debug.Assert(nodeIterator.Current != null);
Debug.Assert(nodeIterator!.Current != null);
return XmlConvert.ToXPathDouble(nodeIterator.Current.Value);
}
object argVal = _arg.Evaluate(nodeIterator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private double StringLength(XPathNodeIterator nodeIterator)
{
return _argList[0].Evaluate(nodeIterator).ToString()!.Length;
}
Debug.Assert(nodeIterator.Current != null);
Debug.Assert(nodeIterator!.Current != null);
return nodeIterator.Current.Value.Length;
}

Expand All @@ -225,7 +225,7 @@ private string Normalize(XPathNodeIterator nodeIterator)
}
else
{
Debug.Assert(nodeIterator.Current != null);
Debug.Assert(nodeIterator!.Current != null);
value = nodeIterator.Current.Value;
}
int modifyPos = -1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable enable
namespace System.Xml.Xsl
{
internal interface ISourceLineInfo
{
string Uri { get; }
string? Uri { get; }
bool IsNoSource { get; }
Location Start { get; }
Location End { get; }
Expand Down
Loading

0 comments on commit 12f8e34

Please sign in to comment.