Merge pull request #249 from pcc/xgetinputfocus
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / ExpressionUtil / ConstantExpressionFingerprint.cs
1 #pragma warning disable 659 // overrides AddToHashCodeCombiner instead
2
3 namespace System.Web.Mvc.ExpressionUtil {
4     using System;
5     using System.Diagnostics.CodeAnalysis;
6     using System.Linq.Expressions;
7
8     // ConstantExpression fingerprint class
9     //
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.
14
15     [SuppressMessage("Microsoft.Usage", "CA2218:OverrideGetHashCodeOnOverridingEquals", Justification = "Overrides AddToHashCodeCombiner() instead.")]
16     internal sealed class ConstantExpressionFingerprint : ExpressionFingerprint {
17
18         public ConstantExpressionFingerprint(ExpressionType nodeType, Type type)
19             : base(nodeType, type) {
20
21             // There are no properties on ConstantExpression that are worth including in
22             // the fingerprint.
23         }
24
25         public override bool Equals(object obj) {
26             ConstantExpressionFingerprint other = obj as ConstantExpressionFingerprint;
27             return (other != null)
28                 && this.Equals(other);
29         }
30
31     }
32 }