/// <summary> /// Constructor /// </summary> /// <param name="decompilerSettingsVersion">Decompiler settings version number. This version number should get incremented when the settings change.</param> /// <param name="stateMachineKind">State machine kind</param> /// <param name="method">Method</param> /// <param name="kickoffMethod">Kickoff method or null</param> /// <param name="locals">Locals</param> /// <param name="parameters">Parameters or null</param> /// <param name="asyncInfo">Async method info or null</param> public MethodDebugInfoBuilder(int decompilerSettingsVersion, StateMachineKind stateMachineKind, MethodDef method, MethodDef kickoffMethod, SourceLocal[] locals, SourceParameter[] parameters, AsyncMethodDebugInfo asyncInfo) : this(decompilerSettingsVersion, stateMachineKind, method, kickoffMethod) { Scope.Locals.AddRange(locals); Parameters = parameters; AsyncInfo = asyncInfo; }
/// <summary> /// Constructor /// </summary> /// <param name="compilerName">Compiler name (<see cref="PredefinedCompilerNames"/>) or null</param> /// <param name="decompilerSettingsVersion">Decompiler settings version number. This version number should get incremented when the settings change.</param> /// <param name="stateMachineKind">State machine kind</param> /// <param name="method">Method</param> /// <param name="kickoffMethod">Kickoff method or null</param> /// <param name="parameters">Parameters or null</param> /// <param name="statements">Statements</param> /// <param name="scope">Root scope</param> /// <param name="methodSpan">Method span or null to calculate it from <paramref name="statements"/></param> /// <param name="asyncMethodDebugInfo">Async info or null</param> public MethodDebugInfo(string compilerName, int decompilerSettingsVersion, StateMachineKind stateMachineKind, MethodDef method, MethodDef kickoffMethod, SourceParameter[] parameters, SourceStatement[] statements, MethodDebugScope scope, TextSpan?methodSpan, AsyncMethodDebugInfo asyncMethodDebugInfo) { if (statements == null) { throw new ArgumentNullException(nameof(statements)); } CompilerName = compilerName; Method = method ?? throw new ArgumentNullException(nameof(method)); KickoffMethod = kickoffMethod; Parameters = parameters ?? Array.Empty <SourceParameter>(); if (statements.Length > 1) { Array.Sort(statements, SourceStatement.SpanStartComparer); } DecompilerSettingsVersion = decompilerSettingsVersion; Statements = statements; Scope = scope ?? throw new ArgumentNullException(nameof(scope)); Span = methodSpan ?? CalculateMethodSpan(statements) ?? new TextSpan(0, 0); AsyncInfo = asyncMethodDebugInfo; }