Don't hard-code comparisons to ValueExpr.

A common pattern in "execute" and "evaluate" implementations is to
test if an expression has a constant value and thus handle it during
compile rather than at runtime.

Previously this was done by directly testing for the ValueExpr node type,
but this tight coupling on type is likely to cause maintenance problems
later so instead we establish a pattern for testing for a constant
value without directly testing the type.