private BoundExpression MakeLiteral(SyntaxNode syntax, ConstantValue constantValue, TypeSymbol type, BoundLiteral oldNodeOpt = null) { Debug.Assert(constantValue != null); if (constantValue.IsDecimal) { // Rewrite decimal literal Debug.Assert((object)type != null); Debug.Assert(type.SpecialType == SpecialType.System_Decimal); return(MakeDecimalLiteral(syntax, constantValue)); } else if (constantValue.IsDateTime) { // C# does not support DateTime constants but VB does; we might have obtained a // DateTime constant by calling a method with an optional parameter with a DateTime // for its default value. Debug.Assert((object)type != null); Debug.Assert(type.SpecialType == SpecialType.System_DateTime); return(MakeDateTimeLiteral(syntax, constantValue)); } else if (oldNodeOpt != null) { return(oldNodeOpt.Update(constantValue, type)); } else { return(new BoundLiteral(syntax, constantValue, type, hasErrors: constantValue.IsBad)); } }
private BoundExpression MakeLiteral(SyntaxNode syntax, ConstantValue constantValue, TypeSymbol type, BoundLiteral oldNodeOpt = null) { Debug.Assert(constantValue != null); if (oldNodeOpt != null) { return(oldNodeOpt.Update(constantValue, type)); } else { return(new BoundLiteral(syntax, constantValue, type, hasErrors: constantValue.IsBad)); } }