-
Notifications
You must be signed in to change notification settings - Fork 4k
/
PreprocessingSymbolInfo.cs
47 lines (39 loc) · 1.49 KB
/
PreprocessingSymbolInfo.cs
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Roslyn.Utilities;
using System;
namespace Microsoft.CodeAnalysis
{
public struct PreprocessingSymbolInfo : IEquatable<PreprocessingSymbolInfo>
{
internal static readonly PreprocessingSymbolInfo None = new PreprocessingSymbolInfo(null, false);
/// <summary>
/// The symbol that was referred to by the identifier, if any.
/// </summary>
public IPreprocessingSymbol? Symbol { get; }
/// <summary>
/// Returns true if this preprocessing symbol is defined at the identifier position.
/// </summary>
public bool IsDefined { get; }
internal PreprocessingSymbolInfo(IPreprocessingSymbol? symbol, bool isDefined)
: this()
{
this.Symbol = symbol;
this.IsDefined = isDefined;
}
public bool Equals(PreprocessingSymbolInfo other)
{
return object.Equals(this.Symbol, other.Symbol)
&& object.Equals(this.IsDefined, other.IsDefined);
}
public override bool Equals(object? obj)
{
return obj is PreprocessingSymbolInfo p && this.Equals(p);
}
public override int GetHashCode()
{
return Hash.Combine(this.IsDefined, Hash.Combine(this.Symbol, 0));
}
}
}