Merge pull request #819 from brendanzagaeski/patch-1
[mono.git] / mcs / class / dlr / Runtime / Microsoft.Scripting.Core / Compiler / DebugInfoGenerator.cs
1 /* ****************************************************************************
2  *
3  * Copyright (c) Microsoft Corporation. 
4  *
5  * This source code is subject to terms and conditions of the Apache License, Version 2.0. A 
6  * copy of the license can be found in the License.html file at the root of this distribution. If 
7  * you cannot locate the  Apache License, Version 2.0, please send an email to 
8  * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
9  * by the terms of the Apache License, Version 2.0.
10  *
11  * You must not remove this notice, or any other, from this software.
12  *
13  *
14  * ***************************************************************************/
15
16 #if !FEATURE_CORE_DLR
17 using Microsoft.Scripting.Ast;
18 using Microsoft.Scripting.Ast.Compiler;
19 #else
20 using System.Linq.Expressions;
21 using System.Linq.Expressions.Compiler;
22 #endif
23
24 using System;
25 using System.Collections.Generic;
26 using System.Text;
27 #if FEATURE_REFEMIT
28 using System.Reflection.Emit;
29 #endif
30 using System.Diagnostics;
31 using System.Diagnostics.SymbolStore;
32 using System.Reflection;
33
34 namespace System.Runtime.CompilerServices {
35 #if !FEATURE_CORE_DLR || SILVERLIGHT
36     using ILGenerator = OffsetTrackingILGenerator;
37 #endif
38
39     /// <summary>
40     /// Generates debug information for lambdas in an expression tree.
41     /// </summary>
42     public abstract class DebugInfoGenerator {
43 #if FEATURE_PDBEMIT
44         /// <summary>
45         /// Creates PDB symbol generator.
46         /// </summary>
47         /// <returns>PDB symbol generator.</returns>
48         public static DebugInfoGenerator CreatePdbGenerator() {
49             return new SymbolDocumentGenerator();
50         }
51 #endif
52         /// <summary>
53         /// Marks a sequence point.
54         /// </summary>
55         /// <param name="method">The lambda being generated.</param>
56         /// <param name="ilOffset">IL offset where to mark the sequence point.</param>
57         /// <param name="sequencePoint">Debug informaton corresponding to the sequence point.</param>
58         public abstract void MarkSequencePoint(LambdaExpression method, int ilOffset, DebugInfoExpression sequencePoint);
59
60 #if FEATURE_REFEMIT
61         internal virtual void MarkSequencePoint(LambdaExpression method, MethodBase methodBase, ILGenerator ilg, DebugInfoExpression sequencePoint) {
62             MarkSequencePoint(method, ilg.ILOffset, sequencePoint);
63         }
64
65         internal virtual void SetLocalName(LocalBuilder localBuilder, string name) {
66             // nop
67         }
68 #endif
69     }
70 }