Skip to content

Commit 155a240

Browse files
committed
CSharpier
1 parent 4075699 commit 155a240

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

crates/bindings-csharp/BSATN.Codegen/Type.cs

+14-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ bool IsNullableReferenceType
2525
internal static string BSATN_FIELD_SUFFIX = "RW";
2626

2727
/// <summary>
28-
/// The name of the static field containing an IReadWrite in the struct BSATN associated with this type.
28+
/// The name of the static field containing an IReadWrite in the struct BSATN associated with this type.
2929
/// </summary>
3030
public string BsatnFieldName
3131
{
@@ -65,7 +65,9 @@ IEnumerable<MemberDeclaration> members
6565
var visStr = SyntaxFacts.GetText(visibility);
6666
return string.Join(
6767
"\n ",
68-
members.Select(m => $"{visStr} static readonly {m.TypeInfo} {m.BsatnFieldName} = new();")
68+
members.Select(m =>
69+
$"{visStr} static readonly {m.TypeInfo} {m.BsatnFieldName} = new();"
70+
)
6971
);
7072
}
7173

@@ -74,7 +76,9 @@ public static string GenerateDefs(IEnumerable<MemberDeclaration> members) =>
7476
",\n ",
7577
// we can't use nameof(m.BsatnFieldName) because the bsatn field name differs from the logical name
7678
// assigned in the type.
77-
members.Select(m => $"new(\"{m.Name}\", {m.BsatnFieldName}.GetAlgebraicType(registrar))")
79+
members.Select(m =>
80+
$"new(\"{m.Name}\", {m.BsatnFieldName}.GetAlgebraicType(registrar))"
81+
)
7882
);
7983
}
8084

@@ -192,7 +196,12 @@ public Scope.Extensions ToExtensions()
192196

193197
if (Kind is TypeKind.Sum)
194198
{
195-
var enumTag = new MemberDeclaration("__enumTag", "@enum", "SpacetimeDB.BSATN.Enum<@enum>", false);
199+
var enumTag = new MemberDeclaration(
200+
"__enumTag",
201+
"@enum",
202+
"SpacetimeDB.BSATN.Enum<@enum>",
203+
false
204+
);
196205

197206
extensions.Contents.Append(
198207
$$"""
@@ -279,9 +288,7 @@ public override string ToString() =>
279288

280289
// It's important that this happen here; only the stuff later in this method
281290
// needs to see the enum tag as one of the bsatn declarations.
282-
bsatnDecls = bsatnDecls.Prepend(
283-
enumTag
284-
);
291+
bsatnDecls = bsatnDecls.Prepend(enumTag);
285292
}
286293
else
287294
{

crates/bindings-csharp/Codegen/Module.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ public ViewIndex(ColumnRef col)
204204
ImmutableArray.Create(col),
205205
null,
206206
ViewIndexType.BTree // this might become hash in the future
207-
)
208-
{ }
207+
) { }
209208

210209
private ViewIndex(Index.BTreeAttribute attr, ImmutableArray<ColumnRef> columns)
211210
: this(attr.Name, columns, attr.Table, ViewIndexType.BTree) { }
@@ -451,8 +450,7 @@ public IEnumerable<View> GenerateViews()
451450
}
452451
foreach (var v in Views)
453452
{
454-
var autoIncFields = Members
455-
.Where(m => m.GetAttrs(v).HasFlag(ColumnAttrs.AutoInc));
453+
var autoIncFields = Members.Where(m => m.GetAttrs(v).HasFlag(ColumnAttrs.AutoInc));
456454

457455
var globalName = $"global::{FullName}";
458456
var iTable = $"SpacetimeDB.Internal.ITableView<{v.Name}, {globalName}>";

0 commit comments

Comments
 (0)