Skip to content

Commit 5703f02

Browse files
committed
rm generator
1 parent 658cb1a commit 5703f02

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/tools/recipe2plan.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {StorageKeyRecipeResolver} from './storage-key-recipe-resolver.js';
2121
export async function recipe2plan(path: string): Promise<string> {
2222
const manifest = await Runtime.parseFile(path);
2323

24-
const recipes = new StorageKeyRecipeResolver(manifest).resolve();
24+
const recipes = await (new StorageKeyRecipeResolver(manifest)).resolve();
2525

2626
const plans = await generatePlans(recipes);
2727

@@ -35,7 +35,7 @@ export async function recipe2plan(path: string): Promise<string> {
3535
* @param resolutions A series of resolved recipes.
3636
* @return List of generated Kotlin plans
3737
*/
38-
async function generatePlans(resolutions: AsyncIterator<Recipe>): Promise<string[]> {
38+
async function generatePlans(resolutions: Recipe[]): Promise<string[]> {
3939
// TODO Implement
4040
return [''];
4141
}

src/tools/storage-key-recipe-resolver.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export class StorageKeyRecipeResolver {
3636
* @throws Error if recipe fails to resolve on first or second pass.
3737
* @yields Resolved recipes with storage keys
3838
*/
39-
async* resolve(): AsyncGenerator<Recipe> {
39+
async resolve(): Promise<Recipe[]> {
40+
const recipes = [];
4041
for (const recipe of this.runtime.context.allRecipes) {
4142
const arc = this.runtime.newArc(this.getArcId(recipe), ramDiskStorageKeyPrefixForTest());
4243
const opts = {errors: new Map<Recipe | RecipeComponent, string>()};
@@ -49,8 +50,9 @@ export class StorageKeyRecipeResolver {
4950
if (!resolved.isResolved()) {
5051
throw Error(`Recipe ${resolved.name} did not properly resolve!\n${resolved.toString({showUnresolved: true})}`);
5152
}
52-
yield resolved;
53+
recipes.push(resolved)
5354
}
55+
return recipes;
5456
}
5557

5658
/**

src/tools/tests/storage-key-recipe-resolver-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('recipe2plan', () => {
4242
data: reads data`);
4343

4444
const resolver = new StorageKeyRecipeResolver(manifest);
45-
for await (const it of resolver.resolve()) {
45+
for (const it of (await resolver.resolve())) {
4646
assert.isTrue(it.isResolved());
4747
}
4848
});

0 commit comments

Comments
 (0)