Created
December 12, 2011 18:18
-
-
Save mkrueger/1468424 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override object Visit (Constant constant) | |
{ | |
if (constant.GetValue () == null) | |
return new NullReferenceExpression (Convert (constant.Location)); | |
string literalValue; | |
if (constant is ILiteralConstant) { | |
literalValue = new string (((ILiteralConstant)constant).ParsedValue); | |
} else { | |
literalValue = constant.GetValueAsLiteral (); | |
} | |
object val = constant.GetValue (); | |
if (val is bool) | |
literalValue = (bool)val ? "true" : "false"; | |
var result = new PrimitiveExpression (val, Convert (constant.Location), literalValue); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment