public override Expression VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) { Expression concatenated = null; foreach (var content in node.Contents) { Expression part; switch (content) { case InterpolationSyntax interpolation: if (_proofSemantics && !interpolation.Expression.IsEvaluatingToPrimitiveType(_semanticModel)) { throw new UnsupportedSyntaxException($"the interpolation '{interpolation}' of a string interpolation will not evaluate to a primitive type"); } part = interpolation.Expression.Accept(this); break; case InterpolatedStringTextSyntax text: // TODO not really necessary at this point as strings do not provide any information. part = new GenericLiteralExpression(); break; default: throw new UnsupportedSyntaxException($"interpolated string '{node}' contains unsupported content '{content}'"); } concatenated = concatenated == null ? part : new AddExpression(concatenated, part); } // Faulty formatted (aka syntax errors) string interpolations as well as empty strings may lead to an empty content list. return(concatenated ?? new GenericLiteralExpression()); }
public ISet <DescriptorKind> Visit(GenericLiteralExpression expression) { return(_emptySet); }
public Expression Visit(GenericLiteralExpression expression) { return(expression); }
public IEnumerable <Expression> Visit(GenericLiteralExpression expression) { return(_emptyEnumerable); }
public SimplifiedExpression Visit(GenericLiteralExpression expression) { return(new SimplifiedExpression(expression)); }
public void Visit(GenericLiteralExpression expression) { }