@@ -30,8 +30,6 @@ export default class Builder {
3030 private isDebug : boolean | '@embroider/macros' ;
3131 private util : ImportUtil ;
3232
33- private expressions : [ CallStatementPath , ( debugIdentifier : t . Expression ) => t . Expression ] [ ] = [ ] ;
34-
3533 constructor (
3634 readonly t : typeof Babel . types ,
3735 util : ImportUtil ,
@@ -149,10 +147,10 @@ export default class Builder {
149147 prefixedIdentifiers . push ( negatedPredicate ) ;
150148 }
151149
152- this . expressions . push ( [
150+ this . expandMacro (
153151 path ,
154152 this . _buildLogicalExpressions ( prefixedIdentifiers , callExpression ) ,
155- ] ) ;
153+ ) ;
156154 }
157155
158156 /**
@@ -211,18 +209,12 @@ export default class Builder {
211209 }
212210
213211 /**
214- * Performs the actually expansion of macros
212+ * Performs the actually expansion of macro
215213 */
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 ( ) ;
226218 }
227219
228220 _debugExpression ( target : NodePath ) {
0 commit comments