1
#pragma warning disable 659 // overrides AddToHashCodeCombiner instead
3 namespace System
.Web
.Mvc
.ExpressionUtil
{
5 using System
.Diagnostics
.CodeAnalysis
;
6 using System
.Linq
.Expressions
;
8 // ConstantExpression fingerprint class
10 // A ConstantExpression might represent a captured local variable, so we can't compile
11 // the value directly into the cached function. Instead, a placeholder is generated
12 // and the value is hoisted into a local variables array. This placeholder can then
13 // be compiled and cached, and the array lookup happens at runtime.
15 [SuppressMessage("Microsoft.Usage", "CA2218:OverrideGetHashCodeOnOverridingEquals", Justification
= "Overrides AddToHashCodeCombiner() instead.")]
16 internal sealed class ConstantExpressionFingerprint
: ExpressionFingerprint
{
18 public ConstantExpressionFingerprint(ExpressionType nodeType
, Type type
)
19 : base(nodeType
, type
) {
21 // There are no properties on ConstantExpression that are worth including in
25 public override bool Equals(object obj
) {
26 ConstantExpressionFingerprint other
= obj
as ConstantExpressionFingerprint
;
27 return (other
!= null)
28 && this.Equals(other
);