Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MethodIL.Symbols.cs « IL « TypeSystem « Common « tools « coreclr « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 58990200f3775c2fc5cb0f311f8d4b10ca5db8d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;

namespace Internal.IL
{
    public partial class MethodIL
    {
        public virtual MethodDebugInformation GetDebugInfo()
        {
            return MethodDebugInformation.None;
        }
    }

    public partial class InstantiatedMethodIL
    {
        public override MethodDebugInformation GetDebugInfo()
        {
            return _methodIL.GetDebugInfo();
        }
    }

    /// <summary>
    /// Represents debug information attached to a <see cref="MethodIL"/>.
    /// </summary>
    public class MethodDebugInformation
    {
        public static MethodDebugInformation None = new MethodDebugInformation();

        public virtual bool IsStateMachineMoveNextMethod => false;

        public virtual IEnumerable<ILSequencePoint> GetSequencePoints()
        {
            return Array.Empty<ILSequencePoint>();
        }

        public virtual IEnumerable<ILLocalVariable> GetLocalVariables()
        {
            return Array.Empty<ILLocalVariable>();
        }

        public virtual IEnumerable<string> GetParameterNames()
        {
            return Array.Empty<string>();
        }
    }

    /// <summary>
    /// Represents a sequence point within an IL method body.
    /// Sequence point describes a point in the method body at which all side effects of
    /// previous evaluations have been performed.
    /// </summary>
    public struct ILSequencePoint
    {
        public readonly int Offset;
        public readonly string Document;
        public readonly int LineNumber;
        // TODO: The remaining info

        public ILSequencePoint(int offset, string document, int lineNumber)
        {
            Offset = offset;
            Document = document;
            LineNumber = lineNumber;
        }
    }

    /// <summary>
    /// Represents information about a local variable within a method body.
    /// </summary>
    public struct ILLocalVariable
    {
        public readonly int Slot;
        public readonly string Name;
        public readonly bool CompilerGenerated;

        public ILLocalVariable(int slot, string name, bool compilerGenerated)
        {
            Slot = slot;
            Name = name;
            CompilerGenerated = compilerGenerated;
        }
    }
}