Skip to content

Commit

Permalink
rm generator
Browse files Browse the repository at this point in the history
  • Loading branch information
alxmrs committed Mar 4, 2020
1 parent 658cb1a commit 5703f02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/tools/recipe2plan.ts
Expand Up @@ -21,7 +21,7 @@ import {StorageKeyRecipeResolver} from './storage-key-recipe-resolver.js';
export async function recipe2plan(path: string): Promise<string> {
const manifest = await Runtime.parseFile(path);

const recipes = new StorageKeyRecipeResolver(manifest).resolve();
const recipes = await (new StorageKeyRecipeResolver(manifest)).resolve();

const plans = await generatePlans(recipes);

Expand All @@ -35,7 +35,7 @@ export async function recipe2plan(path: string): Promise<string> {
* @param resolutions A series of resolved recipes.
* @return List of generated Kotlin plans
*/
async function generatePlans(resolutions: AsyncIterator<Recipe>): Promise<string[]> {
async function generatePlans(resolutions: Recipe[]): Promise<string[]> {
// TODO Implement
return [''];
}
Expand Down
6 changes: 4 additions & 2 deletions src/tools/storage-key-recipe-resolver.ts
Expand Up @@ -36,7 +36,8 @@ export class StorageKeyRecipeResolver {
* @throws Error if recipe fails to resolve on first or second pass.
* @yields Resolved recipes with storage keys
*/
async* resolve(): AsyncGenerator<Recipe> {
async resolve(): Promise<Recipe[]> {
const recipes = [];
for (const recipe of this.runtime.context.allRecipes) {
const arc = this.runtime.newArc(this.getArcId(recipe), ramDiskStorageKeyPrefixForTest());
const opts = {errors: new Map<Recipe | RecipeComponent, string>()};
Expand All @@ -49,8 +50,9 @@ export class StorageKeyRecipeResolver {
if (!resolved.isResolved()) {
throw Error(`Recipe ${resolved.name} did not properly resolve!\n${resolved.toString({showUnresolved: true})}`);
}
yield resolved;
recipes.push(resolved)
}
return recipes;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tests/storage-key-recipe-resolver-test.ts
Expand Up @@ -42,7 +42,7 @@ describe('recipe2plan', () => {
data: reads data`);

const resolver = new StorageKeyRecipeResolver(manifest);
for await (const it of resolver.resolve()) {
for (const it of (await resolver.resolve())) {
assert.isTrue(it.isResolved());
}
});
Expand Down

0 comments on commit 5703f02

Please sign in to comment.