Skip to content

Commit f11860d

Browse files
committed
added particle creation method
1 parent 90c3ffb commit f11860d

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/tools/plan-generator.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
import {Recipe} from '../runtime/recipe/recipe.js';
1111
import {Type} from '../runtime/type.js';
12+
import {Particle} from '../runtime/recipe/particle.js';
1213

1314
export class PlanGenerator {
1415
constructor(private resolutions: Recipe[], private scope: string = 'arcs.core.data') {
@@ -31,17 +32,27 @@ export class PlanGenerator {
3132
for (const recipe of this.resolutions) {
3233
const planName = `${recipe.name.replace(/[rR]ecipe/, '')}Plan`;
3334

35+
const particles = recipe.particles.map(this.createParticle);
36+
3437
const plan = `\
35-
class ${planName} : Plan(particles) {
36-
val particles = listOf()
37-
}`;
38+
object ${planName} : Plan(listOf())`;
39+
3840
plans.push(plan);
3941
}
4042

4143
return plans;
4244
}
4345

44-
mapTypeToProperty(type: Type): string {
46+
createParticle(particle: Particle): string {
47+
return `\
48+
Particle(
49+
${particle.name},
50+
${particle.spec.implFile.replace('/', '.')}
51+
mapOf()
52+
)`;
53+
}
54+
55+
createType(type: Type): string {
4556
switch (type.tag) {
4657
case 'Collection':
4758
break;

0 commit comments

Comments
 (0)