MVC3 integrated, with some changes to make it compile on Mono and with Razor2
[mono-project.git] / mcs / class / System.Web.Mvc3 / Mvc / ExpressionUtil / ConstantExpressionFingerprint.cs
blob61d9714f21dc3aef3dd00f0457e43c0343276b5c
1 #pragma warning disable 659 // overrides AddToHashCodeCombiner instead
3 namespace System.Web.Mvc.ExpressionUtil {
4 using System;
5 using System.Diagnostics.CodeAnalysis;
6 using System.Linq.Expressions;
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.
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
22 // the fingerprint.
25 public override bool Equals(object obj) {
26 ConstantExpressionFingerprint other = obj as ConstantExpressionFingerprint;
27 return (other != null)
28 && this.Equals(other);