File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
import { Recipe } from '../runtime/recipe/recipe.js' ;
11
11
import { Type } from '../runtime/type.js' ;
12
+ import { Particle } from '../runtime/recipe/particle.js' ;
12
13
13
14
export class PlanGenerator {
14
15
constructor ( private resolutions : Recipe [ ] , private scope : string = 'arcs.core.data' ) {
@@ -31,17 +32,27 @@ export class PlanGenerator {
31
32
for ( const recipe of this . resolutions ) {
32
33
const planName = `${ recipe . name . replace ( / [ r R ] e c i p e / , '' ) } Plan` ;
33
34
35
+ const particles = recipe . particles . map ( this . createParticle ) ;
36
+
34
37
const plan = `\
35
- class ${ planName } : Plan(particles) {
36
- val particles = listOf()
37
- }` ;
38
+ object ${ planName } : Plan(listOf())` ;
39
+
38
40
plans . push ( plan ) ;
39
41
}
40
42
41
43
return plans ;
42
44
}
43
45
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 {
45
56
switch ( type . tag ) {
46
57
case 'Collection' :
47
58
break ;
You can’t perform that action at this time.
0 commit comments