Skip to content

Commit 9675462

Browse files
committed
fixing stuff
1 parent 8f5cbb6 commit 9675462

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/FastExpressionCompiler/FastExpressionCompiler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ public static Result TryCollectInfo(ref ClosureInfo closure, Expression expr,
11991199
{
12001200
case ExpressionType.Constant:
12011201
#if LIGHT_EXPRESSION
1202-
if (expr is ConstantRefExpression)
1202+
if (((ConstantExpression)expr).RefField != null)
12031203
{
12041204
// Register the constant expression itself in the closure
12051205
closure.AddConstantOrIncrementUsageCount(expr);
@@ -3434,10 +3434,11 @@ public static bool TryEmitConstant(ConstantExpression expr, Type exprType, ILGen
34343434
{
34353435
var ok = false;
34363436
#if LIGHT_EXPRESSION
3437-
if (expr is ConstantRefExpression cref)
3437+
var refField = expr.RefField;
3438+
if (refField != null)
34383439
{
34393440
Debug.Assert(closure.ContainsConstantsOrNestedLambdas());
3440-
ok = TryEmitConstant(true, null, null, expr, il, ref closure, byRefIndex, cref.RefField);
3441+
ok = TryEmitConstant(true, null, null, expr, il, ref closure, byRefIndex, refField);
34413442
if (!ok) return false;
34423443
}
34433444
else if (expr == NullConstant)
@@ -6616,9 +6617,8 @@ public static bool TryInterpretPrimitive(out object result, Expression expr)
66166617
if (nodeType == ExpressionType.Constant)
66176618
{
66186619
#if LIGHT_EXPRESSION
6619-
if (expr is ConstantRefExpression)
6620+
if (((ConstantExpression)expr).RefField != null)
66206621
return false;
6621-
// todo: @perf check for LightExpression TrueConstant, FalseConstant, etc. and process them specially
66226622
#endif
66236623
result = ((ConstantExpression)expr).Value;
66246624
if (expr.Type == typeof(bool))

0 commit comments

Comments
 (0)