@@ -91,6 +91,7 @@ export default class Generator {
91
91
components : Set < string > ;
92
92
events : Set < string > ;
93
93
transitions : Set < string > ;
94
+ actions : Set < string > ;
94
95
importedComponents : Map < string , string > ;
95
96
namespace : string ;
96
97
hasComponents : boolean ;
@@ -134,6 +135,7 @@ export default class Generator {
134
135
this . components = new Set ( ) ;
135
136
this . events = new Set ( ) ;
136
137
this . transitions = new Set ( ) ;
138
+ this . actions = new Set ( ) ;
137
139
this . importedComponents = new Map ( ) ;
138
140
this . slots = new Set ( ) ;
139
141
@@ -452,7 +454,7 @@ export default class Generator {
452
454
templateProperties [ getName ( prop . key ) ] = prop ;
453
455
} ) ;
454
456
455
- [ 'helpers' , 'events' , 'components' , 'transitions' ] . forEach ( key => {
457
+ [ 'helpers' , 'events' , 'components' , 'transitions' , 'actions' ] . forEach ( key => {
456
458
if ( templateProperties [ key ] ) {
457
459
templateProperties [ key ] . value . properties . forEach ( ( prop : Node ) => {
458
460
this [ key ] . add ( getName ( prop . key ) ) ;
@@ -636,6 +638,12 @@ export default class Generator {
636
638
addDeclaration ( getName ( property . key ) , property . value , 'transitions' ) ;
637
639
} ) ;
638
640
}
641
+
642
+ if ( templateProperties . actions ) {
643
+ templateProperties . actions . value . properties . forEach ( ( property : Node ) => {
644
+ addDeclaration ( getName ( property . key ) , property . value , 'actions' ) ;
645
+ } ) ;
646
+ }
639
647
}
640
648
641
649
if ( indentationLevel ) {
@@ -824,6 +832,16 @@ export default class Generator {
824
832
this . skip ( ) ;
825
833
}
826
834
835
+ if ( node . type === 'Action' && node . expression ) {
836
+ node . metadata = contextualise ( node . expression , contextDependencies , indexes , false ) ;
837
+ if ( node . expression . type === 'CallExpression' ) {
838
+ node . expression . arguments . forEach ( ( arg : Node ) => {
839
+ arg . metadata = contextualise ( arg , contextDependencies , indexes , true ) ;
840
+ } ) ;
841
+ }
842
+ this . skip ( ) ;
843
+ }
844
+
827
845
if ( node . type === 'Component' && node . name === ':Component' ) {
828
846
node . metadata = contextualise ( node . expression , contextDependencies , indexes , false ) ;
829
847
}
0 commit comments