1- namespace AgileObjects . ReadableExpressions
1+ namespace AgileObjects . ReadableExpressions ;
2+
3+ using System ;
4+
5+ /// <summary>
6+ /// Represents a double-slash-commented text comment.
7+ /// </summary>
8+ public class CommentExpression : Expression
29{
3- using System ;
4- #if NET35
5- using Microsoft . Scripting . Ast ;
6- #else
7- using System . Linq . Expressions ;
8- #endif
10+ internal CommentExpression ( string commentText )
11+ {
12+ Comment = new ( commentText ) ;
13+ }
914
1015 /// <summary>
11- /// Represents a double-slash-commented text comment.
16+ /// Converts the given <paramref name="comment"/> to a ConstantExpression of type
17+ /// <see cref="Comment"/>, containing the <see cref="Comment"/> object.
1218 /// </summary>
13- public class CommentExpression : Expression
14- {
15- internal CommentExpression ( string commentText )
16- {
17- Comment = new Comment ( commentText ) ;
18- }
19-
20- /// <summary>
21- /// Converts the given <paramref name="comment"/> to a ConstantExpression of type
22- /// <see cref="Comment"/>, containing the <see cref="Comment"/> object.
23- /// </summary>
24- /// <param name="comment">The <see cref="CommentExpression"/> to convert.</param>
25- public static implicit operator ConstantExpression ( CommentExpression comment )
26- => Constant ( comment . Comment , typeof ( Comment ) ) ;
27-
28- /// <summary>
29- /// Gets the ExpressionType value indicating that this <see cref="CommentExpression"/> should
30- /// be treated as a Constant.
31- /// </summary>
32- public override ExpressionType NodeType => ExpressionType . Constant ;
33-
34- /// <summary>
35- /// Gets the type of this <see cref="CommentExpression"/> - typeof(<see cref="Comment"/>).
36- /// </summary>
37- public override Type Type => typeof ( Comment ) ;
38-
39- /// <summary>
40- /// Gets the <see cref="Comment"/> containing the commented text.
41- /// </summary>
42- public Comment Comment { get ; set ; }
43-
44- /// <inheritdoc />
45- protected override Expression Accept ( ExpressionVisitor visitor ) => this ;
46-
47- /// <summary>
48- /// Gets a string representation of this <see cref="CommentExpression"/>.
49- /// </summary>
50- /// <returns>A string representation of this <see cref="CommentExpression"/>.</returns>
51- public override string ToString ( ) => Comment . ToString ( ) ;
52- }
19+ /// <param name="comment">The <see cref="CommentExpression"/> to convert.</param>
20+ public static implicit operator ConstantExpression ( CommentExpression comment )
21+ => Constant ( comment . Comment , typeof ( Comment ) ) ;
22+
23+ /// <summary>
24+ /// Gets the ExpressionType value indicating that this <see cref="CommentExpression"/> should
25+ /// be treated as a Constant.
26+ /// </summary>
27+ public override ExpressionType NodeType => ExpressionType . Constant ;
28+
29+ /// <summary>
30+ /// Gets the type of this <see cref="CommentExpression"/> - typeof(<see cref="Comment"/>).
31+ /// </summary>
32+ public override Type Type => typeof ( Comment ) ;
33+
34+ /// <summary>
35+ /// Gets the <see cref="Comment"/> containing the commented text.
36+ /// </summary>
37+ public Comment Comment { get ; set ; }
38+
39+ /// <inheritdoc />
40+ protected override Expression Accept ( ExpressionVisitor visitor ) => this ;
41+
42+ /// <summary>
43+ /// Gets a string representation of this <see cref="CommentExpression"/>.
44+ /// </summary>
45+ /// <returns>A string representation of this <see cref="CommentExpression"/>.</returns>
46+ public override string ToString ( ) => Comment . ToString ( ) ;
5347}
0 commit comments