Skip to content

Commit

Permalink
Migrate C# ModuleDef output to V9
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Sep 18, 2024
1 parent 14e5098 commit f63859d
Show file tree
Hide file tree
Showing 25 changed files with 245 additions and 218 deletions.
5 changes: 4 additions & 1 deletion crates/bindings-csharp/BSATN.Codegen/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,13 @@ public void Write(System.IO.BinaryWriter writer, {{ShortName}} value) {
{{write}}
}
public SpacetimeDB.BSATN.AlgebraicType GetAlgebraicType(SpacetimeDB.BSATN.ITypeRegistrar registrar) =>
public SpacetimeDB.BSATN.AlgebraicType.Ref GetAlgebraicType(SpacetimeDB.BSATN.ITypeRegistrar registrar) =>
registrar.RegisterType<{{ShortName}}>(_ => new SpacetimeDB.BSATN.AlgebraicType.{{Kind}}(new SpacetimeDB.BSATN.AggregateElement[] {
{{MemberDeclaration.GenerateDefs(Members)}}
}));
SpacetimeDB.BSATN.AlgebraicType SpacetimeDB.BSATN.IReadWrite<{{ShortName}}>.GetAlgebraicType(SpacetimeDB.BSATN.ITypeRegistrar registrar) =>
GetAlgebraicType(registrar);
}
"""
);
Expand Down
5 changes: 5 additions & 0 deletions crates/bindings-csharp/Codegen.Tests/TestInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,10 @@ public static void Initialize()
},
ScrubberLocation.Last
);
// Auto-accept all snapshot updates when AUTO_VERIFY is set.
if (Environment.GetEnvironmentVariable("AUTO_VERIFY") == "1")
{
VerifierSettings.AutoVerify();
}
}
}
6 changes: 3 additions & 3 deletions crates/bindings-csharp/Codegen.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ static void AssertCompilationSuccessful(Compilation compilation)
emitResult.Success,
string.Join(
"\n",
emitResult.Diagnostics.Select(diag =>
CSharpDiagnosticFormatter.Instance.Format(diag)
)
emitResult
.Diagnostics.Where(diag => diag.Severity != DiagnosticSeverity.Hidden)
.Select(diag => CSharpDiagnosticFormatter.Instance.Format(diag))
)
);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace NestingNamespaces
{
public static partial class AndClasses
{
[SpacetimeDB.Reducer("test_custom_name_and_reducer_ctx")]
[SpacetimeDB.Reducer]
public static void InsertData2(ReducerContext ctx, PublicTable data)
{
data.Insert();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f63859d

Please sign in to comment.