Call SourceMap.reset() before generating code for the --print_source_after_each_pass flag and similar flags.
Otherwise (if source maps are enabled) we get a Preconditions failure when trying to generate code the second time.
@@ -1164,6 +1164,11 @@ public class Compiler extends AbstractCompiler implements ErrorHandler, SourceFi
}
final String getCurrentJsSource() {
+ SourceMap sourceMap = getSourceMap();
+ if (sourceMap != null) {
+ sourceMap.reset();
+ }
+
List<String> fileNameRegexList = options.filesToPrintAfterEachPassRegexList;
List<String> moduleNameRegexList = options.modulesToPrintAfterEachPassRegexList;
StringBuilder builder = new StringBuilder();
