File tree Expand file tree Collapse file tree
modules/angular2/src/transform/reflection_remover Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,25 +128,29 @@ class _RewriterVisitor extends Object with RecursiveAstVisitor<Object> {
128128 var args = node.argumentList.arguments;
129129 int numArgs = node.argumentList.arguments.length;
130130 if (numArgs < 1 || numArgs > 2 ) {
131- logger.warning ('`bootstrap` does not support $numArgs arguments. Found bootstrap${node .argumentList }. Transform may not succeed.' );
131+ logger.warning ('`bootstrap` does not support $numArgs arguments. '
132+ 'Found bootstrap${node .argumentList }. Transform may not succeed.' );
132133 }
133134
134135 var reflectorInit = _setupAdded
135136 ? ''
136137 : ', () { ${_getStaticReflectorInitBlock ()} }' ;
137138
138139 // rewrite `bootstrap(...)` to `bootstrapStatic(...)`
139- buf.write ('bootstrapStatic(' );
140- buf.write (args[0 ]);
140+ buf.write ('bootstrapStatic(${args [0 ]}' );
141141 if (numArgs == 1 ) {
142+ // bootstrap args are positional, so before we pass reflectorInit code
143+ // we need to pass `null` for DI bindings.
142144 if (reflectorInit.isNotEmpty) {
143145 buf.write (', null' );
144146 }
145147 } else {
148+ // pass DI bindings
146149 buf.write (', ${args [1 ]}' );
147150 }
148151 buf.write (reflectorInit);
149152 buf.write (')' );
153+ _setupAdded = true ;
150154 } else {
151155 // leave it as is
152156 buf.write (_rewriter._code.substring (_currentIndex, node.end));
You can’t perform that action at this time.
0 commit comments