1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 namespace System.Diagnostics.SymbolStore
6 {
7     public interface ISymbolMethod
8     {
9         // Get the token for this method.
10         SymbolToken Token { get; }
11 
12         // Get the count of sequence points.
13         int SequencePointCount { get; }
14 
15         // Get the sequence points for this method. The sequence points
16         // are sorted by offset and are for all documents in the
17         // method. Use GetSequencePointCount to retrieve the count of all
18         // sequence points and create arrays of the proper size.
19         // GetSequencePoints will verify the size of each array and place
20         // the sequence point information into each. If any array is NULL,
21         // then the data for that array is simply not returned.
GetSequencePoints(int[] offsets, ISymbolDocument[] documents, int[] lines, int[] columns, int[] endLines, int[] endColumns)22         void GetSequencePoints(int[] offsets,
23                                ISymbolDocument[] documents,
24                                int[] lines,
25                                int[] columns,
26                                int[] endLines,
27                                int[] endColumns);
28 
29         // Get the root lexical scope for this method. This scope encloses
30         // the entire method.
31         ISymbolScope RootScope { get; }
32 
33         // Given an offset within the method, returns the most enclosing
34         // lexical scope. This can be used to start local variable
35         // searches.
GetScope(int offset)36         ISymbolScope GetScope(int offset);
37 
38         // Given a position in a document, return the offset within the
39         // method that corresponds to the position.
GetOffset(ISymbolDocument document, int line, int column)40         int GetOffset(ISymbolDocument document,
41                       int line,
42                       int column);
43 
44         // Given a position in a document, return an array of start/end
45         // offset paris that correspond to the ranges of IL that the
46         // position covers within this method. The array is an array of
47         // integers and is [start,end,start,end]. The number of range
48         // pairs is the length of the array / 2.
GetRanges(ISymbolDocument document, int line, int column)49         int[] GetRanges(ISymbolDocument document,
50                         int line,
51                         int column);
52 
53         // Get the parameters for this method. The paraemeters are
54         // returned in the order they are defined within the method's
55         // signature.
GetParameters()56         ISymbolVariable[] GetParameters();
57 
58         // Get the namespace that this method is defined within.
GetNamespace()59         ISymbolNamespace GetNamespace();
60 
61         // Get the start/end document positions for the source of this
62         // method. The first array position is the start while the second
63         // is the end. Returns true if positions were defined, false
64         // otherwise.
GetSourceStartEnd(ISymbolDocument[] docs, int[] lines, int[] columns)65         bool GetSourceStartEnd(ISymbolDocument[] docs,
66                                int[] lines,
67                                int[] columns);
68     }
69 }
70