code: public static BasicSourceMapConsumer fromSourceMap(SourceMapGenerator aSourceMap) {
          BasicSourceMapConsumer smc = new BasicSourceMapConsumer();
  
          ArraySet<String> names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
          ArraySet<String> sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
          smc.sourceRoot = aSourceMap._sourceRoot;
          smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
          smc.file = aSourceMap._file;
  
          // Because we are modifying the entries (by converting string sources and
          // names to indices into the sources and names ArraySets), we have to make
          // a copy of the entry or else bad things happen. Shared mutable state
          // strikes again! See github issue #191.
  
          List<Mapping> generatedMappings = new ArrayList<>(aSourceMap._mappings.toArray());
          List<ParsedMapping> destGeneratedMappings = smc.__generatedMappings = new ArrayList<>();
          List<ParsedMapping> destOriginalMappings = smc.__originalMappings = new ArrayList<>();
  
          for (int i = 0, length = generatedMappings.size(); i < length; i++) {
              Mapping srcMapping = generatedMappings.get(i);
              ParsedMapping destMapping = new ParsedMapping();
              destMapping.generatedLine = srcMapping.generated.line;
              destMapping.generatedColumn = srcMapping.generated.column;
  
              if (srcMapping.source != null) {
                  destMapping.source = sources.indexOf(srcMapping.source);
                  destMapping.originalLine = srcMapping.original.line;
                  destMapping.originalColumn = srcMapping.original.column;
                  if (srcMapping.name != null) {
                      destMapping.name = names.indexOf(srcMapping.name);
                  }
  
                  destOriginalMappings.add(destMapping);
              }
  
              destGeneratedMappings.add(destMapping);
          }
  
          Collections.sort(smc.__originalMappings, Util::compareByOriginalPositions);
          return smc;
      }
docs: Create a BasicSourceMapConsumer from a SourceMapGenerator.
  
  @param SourceMapGenerator
  aSourceMap The source map that will be consumed.
  @returns BasicSourceMapConsumer