31 lines
1.3 KiB
C#
31 lines
1.3 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
||
|
|
|
||
|
|
public abstract class StructuredTriviaSyntax : CSharpSyntaxNode, IStructuredTriviaSyntax
|
||
|
|
{
|
||
|
|
private SyntaxTrivia _parent;
|
||
|
|
|
||
|
|
public override SyntaxTrivia ParentTrivia => _parent;
|
||
|
|
|
||
|
|
internal StructuredTriviaSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode parent, int position)
|
||
|
|
: base((GreenNode)(object)green, position, (parent == null) ? null : parent.SyntaxTree)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
internal static StructuredTriviaSyntax Create(SyntaxTrivia trivia)
|
||
|
|
{
|
||
|
|
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
GreenNode underlyingNode = ((SyntaxTrivia)(ref trivia)).UnderlyingNode;
|
||
|
|
SyntaxToken token = ((SyntaxTrivia)(ref trivia)).Token;
|
||
|
|
SyntaxNode parent = ((SyntaxToken)(ref token)).Parent;
|
||
|
|
int position = ((SyntaxTrivia)(ref trivia)).Position;
|
||
|
|
StructuredTriviaSyntax obj = (StructuredTriviaSyntax)(object)underlyingNode.CreateRed(parent, position);
|
||
|
|
obj._parent = trivia;
|
||
|
|
return obj;
|
||
|
|
}
|
||
|
|
}
|