Update Reference Sources to .NET Framework 4.6.1
[mono.git] / mcs / class / referencesource / System.Data.SqlXml / System / Xml / Xsl / QIL / QilReference.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="QilReference.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">[....]</owner>
6 //------------------------------------------------------------------------------
7 using System;
8 using System.Diagnostics;
9
10 namespace System.Xml.Xsl.Qil {
11
12     /// <summary>
13     /// View over a Qil node which is the target of a reference (functions, variables, parameters).
14     /// </summary>
15     internal class QilReference : QilNode {
16         // Names longer than 1023 characters cause AV in cscompee.dll, see VSWhidbey 485526
17         // So we set the internal limit to 1000. Needs to be lower since we might later append
18         //   few characters (for example "(2)") if we end up with two same named methods after
19         //   the truncation.
20         private const int MaxDebugNameLength = 1000;
21
22         private string debugName;
23
24         //-----------------------------------------------
25         // Constructor
26         //-----------------------------------------------
27
28         /// <summary>
29         /// Construct a reference
30         /// </summary>
31         public QilReference(QilNodeType nodeType) : base(nodeType) {
32         }
33
34
35         //-----------------------------------------------
36         // QilReference methods
37         //-----------------------------------------------
38
39         /// <summary>
40         /// Name of this reference, preserved for debugging (may be null).
41         /// </summary>
42         public string DebugName {
43             get { return this.debugName; }
44             set {
45                 if (value.Length > MaxDebugNameLength)
46                     value = value.Substring(0, MaxDebugNameLength);
47
48                 this.debugName = value;
49             }
50         }
51     }
52 }