Skip to content

Commit

Permalink
chore: rename async synth to construction
Browse files Browse the repository at this point in the history
  • Loading branch information
spirius committed Nov 27, 2023
1 parent 55ac254 commit 1c54fc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/core/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export interface AppManifest {

export enum AppLifeCycle {
/**
* The synthesis stage is dedicated for new construct creation.
* This stage is applied from top to bottom walk over the construct tree.
* The construction stage is dedicated for new Construct creation.
* This stage is applied by top to bottom walk over the construct tree.
*/
synthesis = "synthesis",
construction = "construction",

/**
* The generation stage is dedicated for resource generation.
* This stage is applied from bottom to top walk over the construct tree.
* This stage is applied by bottom to top walk over the construct tree.
*/
generation = "generation",
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/resolvable/AsyncResolvable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class AsyncResolvable<T = unknown> implements IResolvable {
public readonly scope: Construct,
public readonly name: string,
public readonly resolver: () => Promise<T>,
public readonly stage: AppLifeCycle = AppLifeCycle.synthesis,
public readonly stage: AppLifeCycle = AppLifeCycle.construction,
) {
this.addr = `${scope.node.path},stage=${stage},name=${name}`
App.getAppFromContext(scope).addResolvable(this)
Expand Down
12 changes: 6 additions & 6 deletions src/core/resolvable/TreeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class TreeResolver {
public add(resolvable: AsyncResolvable): void {
const stage: AppLifeCycle = resolvable.stage

if (this.stage && this.stage == AppLifeCycle.generation && stage == AppLifeCycle.synthesis) {
if (this.stage && this.stage == AppLifeCycle.generation && stage == AppLifeCycle.construction) {
throw new Error(
`AsyncResolvable at '${resolvable.addr}' with stage '${stage}' was submitted while being in future stage ${this.stage}`,
)
Expand All @@ -27,7 +27,7 @@ export class TreeResolver {
let resolvables = this.resolvables.get(resolvable.scope)
if (!resolvables) {
resolvables = {
synthesis: [],
construction: [],
generation: [],
}
this.resolvables.set(resolvable.scope, resolvables)
Expand Down Expand Up @@ -63,8 +63,8 @@ export class TreeResolver {
let activity = 0
const state = this.resolvables.get(c)

// synthesis is applied during top to bottom run
if (state && stage === AppLifeCycle.synthesis) {
// construction is applied during top to bottom run
if (state && stage === AppLifeCycle.construction) {
activity += await this.resolveStage(state, stage)
}

Expand All @@ -82,8 +82,8 @@ export class TreeResolver {

/** resolve all resolvables in the construct tree */
public async resolve() {
// resolve the synth stage
while ((await this.visit(this.root, AppLifeCycle.synthesis)) > 0) {
// resolve the construction stage
while ((await this.visit(this.root, AppLifeCycle.construction)) > 0) {
/* continue */
}

Expand Down

0 comments on commit 1c54fc3

Please sign in to comment.