Skip to content

Commit

Permalink
#76, convergence between stages two and three, part 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajvincent committed Mar 2, 2024
1 parent 89033f9 commit 8137c2f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
22 changes: 21 additions & 1 deletion stage_3_generation/build/decorators/createDecorators.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import assert from "node:assert/strict";

import {
StructureKind
Scope,
StructureKind,
} from "ts-morph";

import {
type ClassMemberImpl,
LiteralTypeStructureImpl,
MemberedTypeToClass,
type TypeMembersMap,
Expand Down Expand Up @@ -81,6 +83,24 @@ async function buildDecorator(
}

typeToClass.defineStatementsByPurpose("body", false);

typeToClass.scopeCallback = {
getScope: function(
isStatic: boolean,
kind: ClassMemberImpl["kind"],
memberName: string
): Scope | undefined
{
void(isStatic);
void(kind);
if (memberName === "[COPY_FIELDS]")
return Scope.Public;
if (memberName === "toJSON")
return Scope.Public;
return undefined;
}
};

module.classMembersMap = typeToClass.buildClassMembersMap();

// eslint complains when we say isAsync: boolean = false;
Expand Down
4 changes: 4 additions & 0 deletions stage_3_snapshot/spec-snapshot/fileHashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ describe("File hashes match for the", () => {
await compareSnapshots("source/bootstrap");
});

xit("decorators", async () => {
await compareSnapshots("source/decorators/standard");
});

it("interfaces", async () => {
await compareSnapshots("source/interfaces");
});
Expand Down

0 comments on commit 8137c2f

Please sign in to comment.