Skip to content

Commit 1ca2cde

Browse files
authored
Add multi-targeting TFM for Runtime.Utils (#302)
* This adds `allows ref struct` to `IAstVisitor<TResult, TArg>` for the .NET 9+ versions that support such a thing.
1 parent 8bbc770 commit 1ca2cde

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

IgnoredWords.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ blittable
2525
blockdiag
2626
blog
2727
bool
28+
borked
2829
buildbinoutput
2930
buildtransitive
3031
builtinop

docfx/docfx.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,15 @@
7878
"files": ["**.csproj"]
7979
}
8080
],
81-
"dest": "runtime-utils/api"
81+
"dest": "runtime-utils/api",
82+
"properties": {
83+
// use .NET 8.0 for the TFM as it is multi-targeting
84+
// Sadly, DocFX can't find the dependent project builds if this is .NET 9.0
85+
// and then generates warnings as a result. (DocFX metadata generation is
86+
// pretty well borked and needs replacement as there are a LOT of workarounds
87+
// in this project let alone all the ones found on-line.)
88+
"TargetFramework": "net8.0"
89+
}
8290
},
8391
{
8492
// TextUX library
@@ -90,10 +98,7 @@
9098
"files": ["**.csproj"]
9199
}
92100
],
93-
"dest": "TextUX/api",
94-
"properties": {
95-
"DefineConstants": "DOCFX_BUILD"
96-
}
101+
"dest": "TextUX/api"
97102
}
98103
],
99104
"build": {

src/Ubiquity.NET.Runtime.Utils/IAstVisitor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ public interface IAstVisitor<out TResult>
2121
/// <remarks>
2222
/// <para>This interface is used for visiting an AST, typically for generating code but may also
2323
/// be used to detect errors in the AST etc..</para>
24-
/// <para>The <typeparamref name="TArg"/> is typically used for a Byref-like type where the type
25-
/// may NOT be stored on the heap and MUST be passed via `ref readonly`.</para>
24+
/// <para>In frameworks that support it the <typeparamref name="TArg"/> is typically used for a <c>byref-like</c>
25+
/// type where the type may NOT be stored on the heap and MUST be passed via <c>ref readonly</c>. (Such support
26+
/// requires at least .NET 9 to support <c>allows ref struct</c>, which requires runtime support.)</para>
2627
/// </remarks>
2728
public interface IAstVisitor<out TResult, TArg>
2829
#if NET9_0_OR_GREATER

src/Ubiquity.NET.Runtime.Utils/IParser.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33

44
using System.IO;
55

6+
// CONSIDER: Adaptation that accepts IParsesErrorReporter as a param argument to the parse APIs instead of relying on
7+
// an implementation to "hold" one.
8+
69
namespace Ubiquity.NET.Runtime.Utils
710
{
8-
/// <summary>Core interface for a general parser</summary>
11+
/// <summary>Core interface for a general parser that parses input text into an AST represented as a root <see cref="IAstNode"/></summary>
912
public interface IParser
1013
{
1114
/// <summary>Try parsing the given input text</summary>
1215
/// <param name="txt">Text to parse</param>
1316
/// <returns>Parse results as an <see cref="IAstNode"/></returns>
1417
/// <remarks>
15-
/// If the parse fails then the result is <see langword="false"/>.
18+
/// If the parse fails then the result is <see langword="null"/>.
1619
/// Errors from the parse are reported through error listeners provided
17-
/// to the parser. Normally this is done via the constructor of a type
20+
/// to the parser. Normally, this is done via the constructor of a type
1821
/// implementing this interface.
1922
/// </remarks>
2023
IAstNode? Parse( string txt );

src/Ubiquity.NET.Runtime.Utils/Ubiquity.NET.Runtime.Utils.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
44
<LangVersion>13</LangVersion>
55
<Nullable>enable</Nullable>
66
<!--Until C#14 and the "field" and "extension" keywords are available use the preview language -->

0 commit comments

Comments
 (0)