Files
PURErat-crack-scode/decompiled/Libraries/microsoft.codeanalysis.csharp/Microsoft.CodeAnalysis.CSharp/DebugInfoInjector.cs
T
2026-08-27 10:56:38 -06:00

789 lines
44 KiB
C#

using System;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Shared.Collections;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp;
internal class DebugInfoInjector : CompoundInstrumenter
{
private static readonly DebugInfoInjector s_singleton = new DebugInfoInjector(Instrumenter.NoOp);
private DebugInfoInjector(Instrumenter previous)
: base(previous)
{
}
public static DebugInfoInjector Create(Instrumenter previous)
{
if (previous != Instrumenter.NoOp)
{
return new DebugInfoInjector(previous);
}
return s_singleton;
}
protected override CompoundInstrumenter WithPreviousImpl(Instrumenter previous)
{
return Create(previous);
}
public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
{
return AddSequencePoint(base.InstrumentNoOpStatement(original, rewritten));
}
public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
{
return AddSequencePoint(base.InstrumentBreakStatement(original, rewritten));
}
public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
{
return AddSequencePoint(base.InstrumentContinueStatement(original, rewritten));
}
public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
{
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
rewritten = base.InstrumentExpressionStatement(original, rewritten);
if (original.IsConstructorInitializer())
{
SyntaxNode syntax = original.Syntax;
SyntaxToken val;
TextSpan span;
if (!(syntax is ConstructorDeclarationSyntax constructorDeclarationSyntax))
{
if (!(syntax is ConstructorInitializerSyntax constructorInitializerSyntax))
{
if (!(syntax is TypeDeclarationSyntax typeDeclarationSyntax))
{
if (syntax is PrimaryConstructorBaseTypeSyntax primaryConstructorBaseTypeSyntax)
{
return new BoundSequencePointWithSpan((SyntaxNode)(object)primaryConstructorBaseTypeSyntax, rewritten, ((SyntaxNode)primaryConstructorBaseTypeSyntax).Span);
}
throw ExceptionUtilities.UnexpectedValue((object)original.Syntax.Kind());
}
BoundStatement statementOpt = rewritten;
val = typeDeclarationSyntax.Identifier;
int spanStart = ((SyntaxToken)(ref val)).SpanStart;
span = ((SyntaxNode)typeDeclarationSyntax.ParameterList).Span;
return new BoundSequencePointWithSpan((SyntaxNode)(object)typeDeclarationSyntax, statementOpt, TextSpan.FromBounds(spanStart, ((TextSpan)(ref span)).End));
}
BoundStatement statementOpt2 = rewritten;
val = constructorInitializerSyntax.ThisOrBaseKeyword;
int spanStart2 = ((SyntaxToken)(ref val)).SpanStart;
val = constructorInitializerSyntax.ArgumentList.CloseParenToken;
span = ((SyntaxToken)(ref val)).Span;
return new BoundSequencePointWithSpan((SyntaxNode)(object)constructorInitializerSyntax, statementOpt2, TextSpan.FromBounds(spanStart2, ((TextSpan)(ref span)).End));
}
TextSpan span2;
if (constructorDeclarationSyntax.Modifiers.Any(SyntaxKind.StaticKeyword))
{
val = constructorDeclarationSyntax.Body.OpenBraceToken;
int spanStart3 = ((SyntaxToken)(ref val)).SpanStart;
val = constructorDeclarationSyntax.Body.OpenBraceToken;
span = ((SyntaxToken)(ref val)).Span;
int end = ((TextSpan)(ref span)).End;
span2 = TextSpan.FromBounds(spanStart3, end);
}
else
{
span2 = CreateSpan(constructorDeclarationSyntax.Modifiers, SyntaxNodeOrToken.op_Implicit(constructorDeclarationSyntax.Identifier), SyntaxNodeOrToken.op_Implicit(constructorDeclarationSyntax.ParameterList.CloseParenToken));
}
return new BoundSequencePointWithSpan((SyntaxNode)(object)constructorDeclarationSyntax, rewritten, span2);
}
if (original.Syntax is ParameterSyntax parameterSyntax)
{
return new BoundSequencePointWithSpan((SyntaxNode)(object)parameterSyntax, rewritten, CreateSpan(parameterSyntax));
}
return AddSequencePoint(rewritten);
}
public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
{
rewritten = base.InstrumentFieldOrPropertyInitializer(original, rewritten);
SyntaxNode syntax = original.Syntax;
if (rewritten.Kind == BoundKind.Block)
{
BoundBlock boundBlock = (BoundBlock)rewritten;
return boundBlock.Update(boundBlock.Locals, boundBlock.LocalFunctions, boundBlock.HasUnsafeModifier, boundBlock.Instrumentation, ImmutableArray.Create(InstrumentFieldOrPropertyInitializer(boundBlock.Statements.Single(), syntax)));
}
return InstrumentFieldOrPropertyInitializer(rewritten, syntax);
}
private static BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement rewritten, SyntaxNode syntax)
{
if (syntax.IsKind(SyntaxKind.Parameter))
{
return rewritten;
}
SyntaxNode parent = syntax.Parent.Parent;
return parent.Kind() switch
{
SyntaxKind.VariableDeclarator => AddSequencePoint((VariableDeclaratorSyntax)(object)parent, rewritten),
SyntaxKind.PropertyDeclaration => AddSequencePoint((PropertyDeclarationSyntax)(object)parent, rewritten),
_ => throw ExceptionUtilities.UnexpectedValue((object)parent.Kind()),
};
}
public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
{
return AddSequencePoint(base.InstrumentGotoStatement(original, rewritten));
}
public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
{
return AddSequencePoint(base.InstrumentThrowStatement(original, rewritten));
}
public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
rewritten = base.InstrumentYieldBreakStatement(original, rewritten);
if (original.WasCompilerGenerated && original.Syntax.Kind() == SyntaxKind.Block)
{
SyntaxNode syntax = original.Syntax;
BoundStatement statementOpt = rewritten;
SyntaxToken closeBraceToken = ((BlockSyntax)(object)original.Syntax).CloseBraceToken;
return new BoundSequencePointWithSpan(syntax, statementOpt, ((SyntaxToken)(ref closeBraceToken)).Span);
}
return AddSequencePoint(rewritten);
}
public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
{
return AddSequencePoint(base.InstrumentYieldReturnStatement(original, rewritten));
}
public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
base.InstrumentBlock(original, rewriter, ref additionalLocals, out BoundStatement prologue2, out BoundStatement epilogue2, out instrumentation);
prologue = prologue2;
epilogue = epilogue2;
if (original.Syntax is BlockSyntax blockSyntax && !original.WasCompilerGenerated)
{
SyntaxNode syntax = original.Syntax;
BoundStatement statementOpt = prologue2;
SyntaxToken val = blockSyntax.OpenBraceToken;
prologue = new BoundSequencePointWithSpan(syntax, statementOpt, ((SyntaxToken)(ref val)).Span);
SyntaxNode parent = original.Syntax.Parent;
if (parent == null || (!parent.IsAnonymousFunction() && !(parent is BaseMethodDeclarationSyntax)))
{
SyntaxNode syntax2 = original.Syntax;
BoundStatement statementOpt2 = epilogue2;
val = blockSyntax.CloseBraceToken;
epilogue = new BoundSequencePointWithSpan(syntax2, statementOpt2, ((SyntaxToken)(ref val)).Span);
}
return;
}
if (original != rewriter.CurrentMethodBody)
{
return;
}
if (prologue2 != null || rewriter.Factory.TopLevelMethod is SynthesizedSimpleProgramEntryPointSymbol)
{
goto IL_00e1;
}
if (original.Syntax is RecordDeclarationSyntax recordDeclarationSyntax)
{
ParameterListSyntax parameterList = recordDeclarationSyntax.ParameterList;
if (parameterList != null && parameterList.Parameters.Count > 0)
{
goto IL_00e1;
}
}
goto IL_00eb;
IL_00e1:
prologue = BoundSequencePoint.CreateHidden(prologue2);
goto IL_00eb;
IL_00eb:
if (epilogue2 != null)
{
epilogue = BoundSequencePoint.CreateHidden(epilogue2);
}
}
public override BoundExpression InstrumentDoStatementCondition(BoundDoStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
{
return AddConditionSequencePoint(base.InstrumentDoStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
}
public override BoundExpression InstrumentWhileStatementCondition(BoundWhileStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
{
return AddConditionSequencePoint(base.InstrumentWhileStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
}
public override BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
DoStatementSyntax doStatementSyntax = (DoStatementSyntax)(object)original.Syntax;
SyntaxToken val = doStatementSyntax.WhileKeyword;
int spanStart = ((SyntaxToken)(ref val)).SpanStart;
val = doStatementSyntax.SemicolonToken;
TextSpan span = ((SyntaxToken)(ref val)).Span;
TextSpan span2 = TextSpan.FromBounds(spanStart, ((TextSpan)(ref span)).End);
return new BoundSequencePointWithSpan((SyntaxNode)(object)doStatementSyntax, base.InstrumentDoStatementConditionalGotoStart(original, ifConditionGotoStart), span2);
}
public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
WhileStatementSyntax whileStatementSyntax = (WhileStatementSyntax)(object)original.Syntax;
SyntaxToken val = whileStatementSyntax.WhileKeyword;
int spanStart = ((SyntaxToken)(ref val)).SpanStart;
val = whileStatementSyntax.CloseParenToken;
TextSpan span = ((SyntaxToken)(ref val)).Span;
TextSpan span2 = TextSpan.FromBounds(spanStart, ((TextSpan)(ref span)).End);
return new BoundSequencePointWithSpan((SyntaxNode)(object)whileStatementSyntax, base.InstrumentWhileStatementConditionalGotoStartOrBreak(original, ifConditionGotoStart), span2);
}
public override BoundStatement InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
{
return new BoundSequencePoint((SyntaxNode)(object)((CommonForEachStatementSyntax)(object)original.Syntax).Expression, base.InstrumentForEachStatementCollectionVarDeclaration(original, collectionVarDecl));
}
public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
ForEachVariableStatementSyntax forEachVariableStatementSyntax = (ForEachVariableStatementSyntax)(object)original.Syntax;
return new BoundSequencePointWithSpan((SyntaxNode)(object)forEachVariableStatementSyntax, base.InstrumentForEachStatementDeconstructionVariablesDeclaration(original, iterationVarDecl), ((SyntaxNode)forEachVariableStatementSyntax.Variable).Span);
}
public override BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
CommonForEachStatementSyntax commonForEachStatementSyntax = (CommonForEachStatementSyntax)(object)original.Syntax;
SyntaxToken awaitKeyword = commonForEachStatementSyntax.AwaitKeyword;
SyntaxToken val = default(SyntaxToken);
TextSpan val2;
if (!(awaitKeyword != val))
{
val = commonForEachStatementSyntax.ForEachKeyword;
val2 = ((SyntaxToken)(ref val)).Span;
}
else
{
val = commonForEachStatementSyntax.AwaitKeyword;
TextSpan span = ((SyntaxToken)(ref val)).Span;
int start = ((TextSpan)(ref span)).Start;
val = commonForEachStatementSyntax.ForEachKeyword;
span = ((SyntaxToken)(ref val)).Span;
val2 = TextSpan.FromBounds(start, ((TextSpan)(ref span)).End);
}
TextSpan span2 = val2;
BoundSequencePointWithSpan item = new BoundSequencePointWithSpan((SyntaxNode)(object)commonForEachStatementSyntax, null, span2);
return new BoundStatementList((SyntaxNode)(object)commonForEachStatementSyntax, ImmutableArray.Create(item, base.InstrumentForEachStatement(original, rewritten)));
}
public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
TextSpan span;
switch (original.Syntax.Kind())
{
case SyntaxKind.ForEachStatement:
{
ForEachStatementSyntax forEachStatementSyntax = (ForEachStatementSyntax)(object)original.Syntax;
int spanStart = ((SyntaxNode)forEachStatementSyntax.Type).SpanStart;
SyntaxToken identifier = forEachStatementSyntax.Identifier;
TextSpan span2 = ((SyntaxToken)(ref identifier)).Span;
span = TextSpan.FromBounds(spanStart, ((TextSpan)(ref span2)).End);
break;
}
case SyntaxKind.ForEachVariableStatement:
span = ((SyntaxNode)((ForEachVariableStatementSyntax)(object)original.Syntax).Variable).Span;
break;
default:
throw ExceptionUtilities.UnexpectedValue((object)original.Syntax.Kind());
}
return new BoundSequencePointWithSpan(original.Syntax, base.InstrumentForEachStatementIterationVarDeclaration(original, iterationVarDecl), span);
}
public override BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
{
return BoundSequencePoint.Create(original.Condition?.Syntax, base.InstrumentForStatementConditionalGotoStartOrBreak(original, branchBack));
}
public override BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
CommonForEachStatementSyntax commonForEachStatementSyntax = (CommonForEachStatementSyntax)(object)original.Syntax;
BoundStatement statementOpt = base.InstrumentForEachStatementConditionalGotoStart(original, branchBack);
SyntaxToken inKeyword = commonForEachStatementSyntax.InKeyword;
return new BoundSequencePointWithSpan((SyntaxNode)(object)commonForEachStatementSyntax, statementOpt, ((SyntaxToken)(ref inKeyword)).Span);
}
public override BoundExpression InstrumentForStatementCondition(BoundForStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
{
return AddConditionSequencePoint(base.InstrumentForStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
}
public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
IfStatementSyntax ifStatementSyntax = (IfStatementSyntax)(object)original.Syntax;
BoundStatement statementOpt = base.InstrumentIfStatement(original, rewritten);
SyntaxToken val = ifStatementSyntax.IfKeyword;
int spanStart = ((SyntaxToken)(ref val)).SpanStart;
val = ifStatementSyntax.CloseParenToken;
TextSpan span = ((SyntaxToken)(ref val)).Span;
return new BoundSequencePointWithSpan((SyntaxNode)(object)ifStatementSyntax, statementOpt, TextSpan.FromBounds(spanStart, ((TextSpan)(ref span)).End), original.HasErrors);
}
public override BoundExpression InstrumentIfStatementCondition(BoundIfStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
{
return AddConditionSequencePoint(base.InstrumentIfStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
}
public override BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
LabeledStatementSyntax labeledStatementSyntax = (LabeledStatementSyntax)(object)original.Syntax;
SyntaxToken val = labeledStatementSyntax.Identifier;
int spanStart = ((SyntaxToken)(ref val)).SpanStart;
val = labeledStatementSyntax.ColonToken;
TextSpan span = ((SyntaxToken)(ref val)).Span;
TextSpan span2 = TextSpan.FromBounds(spanStart, ((TextSpan)(ref span)).End);
return new BoundSequencePointWithSpan((SyntaxNode)(object)labeledStatementSyntax, base.InstrumentLabelStatement(original, rewritten), span2);
}
public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
return AddSequencePoint((original.Syntax.Kind() == SyntaxKind.VariableDeclarator) ? ((VariableDeclaratorSyntax)(object)original.Syntax) : ((LocalDeclarationStatementSyntax)(object)original.Syntax).Declaration.Variables.First(), base.InstrumentUserDefinedLocalInitialization(original, rewritten));
}
public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
LockStatementSyntax lockStatementSyntax = (LockStatementSyntax)(object)original.Syntax;
BoundStatement statementOpt = base.InstrumentLockTargetCapture(original, lockTargetCapture);
SyntaxToken val = lockStatementSyntax.LockKeyword;
int spanStart = ((SyntaxToken)(ref val)).SpanStart;
val = lockStatementSyntax.CloseParenToken;
TextSpan span = ((SyntaxToken)(ref val)).Span;
return new BoundSequencePointWithSpan((SyntaxNode)(object)lockStatementSyntax, statementOpt, TextSpan.FromBounds(spanStart, ((TextSpan)(ref span)).End));
}
public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
rewritten = base.InstrumentReturnStatement(original, rewritten);
if (original.WasCompilerGenerated && original.ExpressionOpt == null && original.Syntax.Kind() == SyntaxKind.Block)
{
SyntaxNode syntax = original.Syntax;
BoundStatement statementOpt = rewritten;
SyntaxToken closeBraceToken = ((BlockSyntax)(object)original.Syntax).CloseBraceToken;
return new BoundSequencePointWithSpan(syntax, statementOpt, ((SyntaxToken)(ref closeBraceToken)).Span);
}
if (original.Syntax is ParameterSyntax parameterSyntax)
{
return new BoundSequencePointWithSpan((SyntaxNode)(object)parameterSyntax, rewritten, CreateSpan(parameterSyntax));
}
return new BoundSequencePoint(original.Syntax, rewritten);
}
public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
SwitchStatementSyntax switchStatementSyntax = (SwitchStatementSyntax)(object)original.Syntax;
SyntaxToken val = switchStatementSyntax.SwitchKeyword;
int spanStart = ((SyntaxToken)(ref val)).SpanStart;
SyntaxToken closeParenToken = switchStatementSyntax.CloseParenToken;
val = default(SyntaxToken);
TextSpan span;
int end;
if (!(closeParenToken != val))
{
span = ((SyntaxNode)switchStatementSyntax.Expression).Span;
end = ((TextSpan)(ref span)).End;
}
else
{
val = switchStatementSyntax.CloseParenToken;
span = ((SyntaxToken)(ref val)).Span;
end = ((TextSpan)(ref span)).End;
}
TextSpan span2 = TextSpan.FromBounds(spanStart, end);
return new BoundSequencePointWithSpan((SyntaxNode)(object)switchStatementSyntax, base.InstrumentSwitchStatement(original, rewritten), span2);
}
public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
WhenClauseSyntax whenClauseSyntax = original.Syntax.FirstAncestorOrSelf<WhenClauseSyntax>((Func<WhenClauseSyntax, bool>)null, true);
return new BoundSequencePointWithSpan((SyntaxNode)(object)whenClauseSyntax, base.InstrumentSwitchWhenClauseConditionalGotoBody(original, ifConditionGotoBody), ((SyntaxNode)whenClauseSyntax).Span);
}
public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
{
return AddSequencePoint((UsingStatementSyntax)(object)original.Syntax, base.InstrumentUsingTargetCapture(original, usingTargetCapture));
}
public override void InstrumentCatchBlock(BoundCatchBlock original, ref BoundExpression? rewrittenSource, ref BoundStatementList? rewrittenFilterPrologue, ref BoundExpression? rewrittenFilter, ref BoundBlock rewrittenBody, ref TypeSymbol? rewrittenType, SyntheticBoundNodeFactory factory)
{
base.InstrumentCatchBlock(original, ref rewrittenSource, ref rewrittenFilterPrologue, ref rewrittenFilter, ref rewrittenBody, ref rewrittenType, factory);
if (!original.WasCompilerGenerated && rewrittenFilter != null)
{
CatchFilterClauseSyntax filter = ((CatchClauseSyntax)(object)original.Syntax).Filter;
rewrittenFilter = AddConditionSequencePoint(new BoundSequencePointExpression((SyntaxNode)(object)filter, rewrittenFilter, rewrittenFilter.Type), (SyntaxNode)(object)filter, factory);
}
}
public override BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
{
return AddConditionSequencePoint(base.InstrumentSwitchStatementExpression(original, rewrittenExpression, factory), original.Syntax, factory);
}
public override BoundExpression InstrumentSwitchExpressionArmExpression(BoundExpression original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
{
return new BoundSequencePointExpression(original.Syntax, base.InstrumentSwitchExpressionArmExpression(original, rewrittenExpression, factory), rewrittenExpression.Type);
}
public override BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
{
return BoundSequencePoint.CreateHidden(base.InstrumentSwitchBindCasePatternVariables(bindings));
}
private static BoundStatement AddSequencePoint(BoundStatement node)
{
return new BoundSequencePoint(node.Syntax, node);
}
internal static BoundStatement AddSequencePoint(VariableDeclaratorSyntax declaratorSyntax, BoundStatement rewrittenStatement)
{
GetBreakpointSpan(declaratorSyntax, out SyntaxNode _, out TextSpan? part);
BoundStatement boundStatement = BoundSequencePoint.Create((SyntaxNode?)(object)declaratorSyntax, part, rewrittenStatement);
boundStatement.WasCompilerGenerated = rewrittenStatement.WasCompilerGenerated;
return boundStatement;
}
internal static BoundStatement AddSequencePoint(PropertyDeclarationSyntax declarationSyntax, BoundStatement rewrittenStatement)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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)
int spanStart = ((SyntaxNode)declarationSyntax.Initializer.Value).SpanStart;
TextSpan span = ((SyntaxNode)declarationSyntax.Initializer).Span;
int end = ((TextSpan)(ref span)).End;
TextSpan value = TextSpan.FromBounds(spanStart, end);
BoundStatement boundStatement = BoundSequencePoint.Create((SyntaxNode?)(object)declarationSyntax, value, rewrittenStatement);
boundStatement.WasCompilerGenerated = rewrittenStatement.WasCompilerGenerated;
return boundStatement;
}
internal static BoundStatement AddSequencePoint(UsingStatementSyntax usingSyntax, BoundStatement rewrittenStatement)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
TextSpan span = ((SyntaxNode)usingSyntax).Span;
int start = ((TextSpan)(ref span)).Start;
SyntaxToken closeParenToken = usingSyntax.CloseParenToken;
span = ((SyntaxToken)(ref closeParenToken)).Span;
int end = ((TextSpan)(ref span)).End;
TextSpan span2 = TextSpan.FromBounds(start, end);
return new BoundSequencePointWithSpan((SyntaxNode)(object)usingSyntax, rewrittenStatement, span2);
}
private static TextSpan CreateSpan(ParameterSyntax parameter)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
return CreateSpan(parameter.Modifiers, SyntaxNodeOrToken.op_Implicit((SyntaxNode)(object)parameter.Type), SyntaxNodeOrToken.op_Implicit(parameter.Identifier));
}
private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
int num;
if (((SyntaxTokenList)(ref startOpt)).Count <= 0)
{
num = ((!(startFallbackOpt != default(SyntaxNodeOrToken))) ? ((SyntaxNodeOrToken)(ref endOpt)).SpanStart : ((SyntaxNodeOrToken)(ref startFallbackOpt)).SpanStart);
}
else
{
SyntaxToken val = ((SyntaxTokenList)(ref startOpt)).First();
num = ((SyntaxToken)(ref val)).SpanStart;
}
int num2 = ((!(endOpt != default(SyntaxNodeOrToken))) ? GetEndPosition(startFallbackOpt) : GetEndPosition(endOpt));
return TextSpan.FromBounds(num, num2);
}
private static int GetEndPosition(SyntaxNodeOrToken nodeOrToken)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
SyntaxNode val = default(SyntaxNode);
TextSpan span;
if (!((SyntaxNodeOrToken)(ref nodeOrToken)).AsNode(ref val))
{
span = ((SyntaxNodeOrToken)(ref nodeOrToken)).Span;
return ((TextSpan)(ref span)).End;
}
SyntaxToken lastToken = val.GetLastToken(false, false, false, false);
span = ((SyntaxToken)(ref lastToken)).Span;
return ((TextSpan)(ref span)).End;
}
internal static void GetBreakpointSpan(VariableDeclaratorSyntax declaratorSyntax, out SyntaxNode node, out TextSpan? part)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
VariableDeclarationSyntax variableDeclarationSyntax = (VariableDeclarationSyntax)declaratorSyntax.Parent;
if (variableDeclarationSyntax.Variables.First() == declaratorSyntax)
{
switch (variableDeclarationSyntax.Parent.Kind())
{
case SyntaxKind.FieldDeclaration:
case SyntaxKind.EventFieldDeclaration:
{
SyntaxTokenList modifiers2 = ((BaseFieldDeclarationSyntax)variableDeclarationSyntax.Parent).Modifiers;
GetFirstLocalOrFieldBreakpointSpan(((SyntaxTokenList)(ref modifiers2)).Any() ? new SyntaxToken?(((SyntaxTokenList)(ref modifiers2))[0]) : ((SyntaxToken?)null), declaratorSyntax, out node, out part);
break;
}
case SyntaxKind.LocalDeclarationStatement:
{
LocalDeclarationStatementSyntax localDeclarationStatementSyntax = (LocalDeclarationStatementSyntax)variableDeclarationSyntax.Parent;
SyntaxTokenList modifiers = localDeclarationStatementSyntax.Modifiers;
GetFirstLocalOrFieldBreakpointSpan(((SyntaxTokenList)(ref modifiers)).Any() ? new SyntaxToken?(((SyntaxTokenList)(ref modifiers))[0]) : ((localDeclarationStatementSyntax.UsingKeyword == default(SyntaxToken)) ? ((SyntaxToken?)null) : new SyntaxToken?((localDeclarationStatementSyntax.AwaitKeyword == default(SyntaxToken)) ? localDeclarationStatementSyntax.UsingKeyword : localDeclarationStatementSyntax.AwaitKeyword)), declaratorSyntax, out node, out part);
break;
}
case SyntaxKind.ForStatement:
case SyntaxKind.UsingStatement:
case SyntaxKind.FixedStatement:
{
node = (SyntaxNode)(object)variableDeclarationSyntax;
int spanStart = ((SyntaxNode)variableDeclarationSyntax).SpanStart;
TextSpan span = ((SyntaxNode)declaratorSyntax).Span;
part = TextSpan.FromBounds(spanStart, ((TextSpan)(ref span)).End);
break;
}
default:
throw ExceptionUtilities.UnexpectedValue((object)variableDeclarationSyntax.Parent.Kind());
}
}
else
{
node = (SyntaxNode)(object)declaratorSyntax;
part = null;
}
}
internal static void GetFirstLocalOrFieldBreakpointSpan(SyntaxToken? firstToken, VariableDeclaratorSyntax declaratorSyntax, out SyntaxNode node, out TextSpan? part)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
VariableDeclarationSyntax variableDeclarationSyntax = (VariableDeclarationSyntax)declaratorSyntax.Parent;
int spanStart;
if (!firstToken.HasValue)
{
spanStart = ((SyntaxNode)variableDeclarationSyntax).SpanStart;
}
else
{
SyntaxToken valueOrDefault = firstToken.GetValueOrDefault();
spanStart = ((SyntaxToken)(ref valueOrDefault)).SpanStart;
}
int num = spanStart;
TextSpan span;
int end;
if (variableDeclarationSyntax.Variables.Count == 1)
{
span = ((SyntaxNode)variableDeclarationSyntax.Parent).Span;
end = ((TextSpan)(ref span)).End;
}
else
{
span = ((SyntaxNode)declaratorSyntax).Span;
end = ((TextSpan)(ref span)).End;
}
part = TextSpan.FromBounds(num, end);
node = (SyntaxNode)(object)variableDeclarationSyntax.Parent;
}
private static BoundExpression AddConditionSequencePoint(BoundExpression condition, SyntaxNode synthesizedVariableSyntax, SyntheticBoundNodeFactory factory)
{
if (!((CompilationOptions)factory.Compilation.Options).EnableEditAndContinue)
{
return condition;
}
LocalSymbol localSymbol = factory.SynthesizedLocal(condition.Type, synthesizedVariableSyntax, isPinned: false, isKnownToReferToTempIfReferenceType: false, (RefKind)0, (SynthesizedLocalKind)1);
BoundExpression value = ((condition.ConstantValueOpt == (ConstantValue)null) ? new BoundSequencePointExpression(null, factory.Local(localSymbol), condition.Type) : condition);
return new BoundSequence(condition.Syntax, ImmutableArray.Create(localSymbol), ImmutableArray.Create(factory.AssignmentExpression(factory.Local(localSymbol), condition)), value, condition.Type);
}
}