File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,24 +5,40 @@ namespace MLIR.Semantics;
55/// <summary>
66/// Represents a typed reference to a block label in the semantic layer.
77/// </summary>
8- /// <remarks>
9- /// Initializes a new instance of the <see cref="BlockReference"/> struct.
10- /// </remarks>
11- /// <param name="token">The syntax token for the block label.</param>
12- public readonly struct BlockReference ( SyntaxToken token )
8+ public readonly struct BlockReference
139{
10+ /// <summary>
11+ /// Initializes a new instance of the <see cref="BlockReference"/> struct from a syntax token.
12+ /// </summary>
13+ /// <param name="token">The syntax token for the block label.</param>
14+ public BlockReference ( SyntaxToken token )
15+ {
16+ Token = token ;
17+ Label = token . Text ;
18+ }
19+
20+ /// <summary>
21+ /// Initializes a new instance of the <see cref="BlockReference"/> struct from a label text.
22+ /// </summary>
23+ /// <param name="label">The block label text.</param>
24+ public BlockReference ( string label )
25+ {
26+ Token = null ;
27+ Label = label ;
28+ }
29+
1430 /// <summary>
1531 /// Gets the syntax token for the block label.
1632 /// </summary>
17- public SyntaxToken Token { get ; } = token ;
33+ public SyntaxToken ? Token { get ; }
1834
1935 /// <summary>
2036 /// Gets the block label text.
2137 /// </summary>
22- public string Label => Token . Text ;
38+ public string Label { get ; }
2339
2440 /// <summary>
2541 /// Gets the source location of the block label, if known.
2642 /// </summary>
27- public SourceLocation Location => SourceLocation . FromToken ( Token ) ;
43+ public SourceLocation Location => Token . HasValue ? SourceLocation . FromToken ( Token . Value ) : SourceLocation . Unknown ;
2844}
Original file line number Diff line number Diff line change @@ -5,24 +5,40 @@ namespace MLIR.Semantics;
55/// <summary>
66/// Represents a typed reference to an SSA value in the semantic layer.
77/// </summary>
8- /// <remarks>
9- /// Initializes a new instance of the <see cref="ValueReference"/> struct.
10- /// </remarks>
11- /// <param name="token">The syntax token for the SSA value.</param>
12- public readonly struct ValueReference ( SyntaxToken token )
8+ public readonly struct ValueReference
139{
10+ /// <summary>
11+ /// Initializes a new instance of the <see cref="ValueReference"/> struct from a syntax token.
12+ /// </summary>
13+ /// <param name="token">The syntax token for the SSA value.</param>
14+ public ValueReference ( SyntaxToken token )
15+ {
16+ Token = token ;
17+ Name = token . Text ;
18+ }
19+
20+ /// <summary>
21+ /// Initializes a new instance of the <see cref="ValueReference"/> struct from a value name.
22+ /// </summary>
23+ /// <param name="name">The SSA value name.</param>
24+ public ValueReference ( string name )
25+ {
26+ Token = null ;
27+ Name = name ;
28+ }
29+
1430 /// <summary>
1531 /// Gets the syntax token for the SSA value.
1632 /// </summary>
17- public SyntaxToken Token { get ; } = token ;
33+ public SyntaxToken ? Token { get ; }
1834
1935 /// <summary>
2036 /// Gets the SSA value name.
2137 /// </summary>
22- public string Name => Token . Text ;
38+ public string Name { get ; }
2339
2440 /// <summary>
2541 /// Gets the source location of the SSA value, if known.
2642 /// </summary>
27- public SourceLocation Location => SourceLocation . FromToken ( Token ) ;
43+ public SourceLocation Location => Token . HasValue ? SourceLocation . FromToken ( Token . Value ) : SourceLocation . Unknown ;
2844}
You can’t perform that action at this time.
0 commit comments