@@ -30,8 +30,6 @@ export default class Builder {
30
30
private isDebug : boolean | '@embroider/macros' ;
31
31
private util : ImportUtil ;
32
32
33
- private expressions : [ CallStatementPath , ( debugIdentifier : t . Expression ) => t . Expression ] [ ] = [ ] ;
34
-
35
33
constructor (
36
34
readonly t : typeof Babel . types ,
37
35
util : ImportUtil ,
@@ -149,10 +147,10 @@ export default class Builder {
149
147
prefixedIdentifiers . push ( negatedPredicate ) ;
150
148
}
151
149
152
- this . expressions . push ( [
150
+ this . expandMacro (
153
151
path ,
154
152
this . _buildLogicalExpressions ( prefixedIdentifiers , callExpression ) ,
155
- ] ) ;
153
+ ) ;
156
154
}
157
155
158
156
/**
@@ -211,18 +209,12 @@ export default class Builder {
211
209
}
212
210
213
211
/**
214
- * Performs the actually expansion of macros
212
+ * Performs the actually expansion of macro
215
213
*/
216
- expandMacros ( ) {
217
- let t = this . t ;
218
- for ( let i = 0 ; i < this . expressions . length ; i ++ ) {
219
- let expression = this . expressions [ i ] ;
220
- let exp = expression [ 0 ] ;
221
- let flag = this . _debugExpression ( exp ) ;
222
- let logicalExp = expression [ 1 ] ;
223
- exp . replaceWith ( t . parenthesizedExpression ( logicalExp ( flag ) ) ) ;
224
- exp . scope . crawl ( ) ;
225
- }
214
+ expandMacro ( exp : CallStatementPath , logicalExp : ( debugIdentifier : t . Expression ) => t . Expression ) {
215
+ const flag = this . _debugExpression ( exp ) ;
216
+ exp . replaceWith ( this . t . parenthesizedExpression ( logicalExp ( flag ) ) ) ;
217
+ exp . scope . crawl ( ) ;
226
218
}
227
219
228
220
_debugExpression ( target : NodePath ) {
0 commit comments