private synchronized void addSourceMapSourceFiles ( SourceMapInput inputSourceMap ) { // synchronized annotation guards concurrent access to sourceMap during parsing. SourceMapConsumerV3 consumer = inputSourceMap . getSourceMap ( errorManager ) ; if ( consumer == null ) { return ; } Collection < String > sourcesContent = consumer . getOriginalSourcesContent ( ) ; if ( sourcesContent == null ) { return ; } Iterator < String > content = sourcesContent . iterator ( ) ; Iterator < String > sources = consumer . getOriginalSources ( ) . iterator ( ) ; while ( sources . hasNext ( ) && content . hasNext ( ) ) { String code = content . next ( ) ; SourceFile source = SourceMapResolver . getRelativePath ( inputSourceMap . getOriginalPath ( ) , sources . next ( ) ) ; if ( source != null ) { sourceMap . addSourceFile ( source . getOriginalPath ( ) , code ) ; } } if ( sources . hasNext ( ) || content . hasNext ( ) ) { throw new RuntimeException ( "Source map's \"sources\" and \"sourcesContent\" lengths do not match." ) ; } }
Adds file name to content mappings for all sources found in a source map . This is used to populate sourcesContent array in the output source map even for sources embedded in the input source map .