Add a deep copy method for SourceMap (#61)
This commit is contained in:
Родитель
384c124c54
Коммит
284e424ba0
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace SourcemapToolkit.SourcemapParser
|
||||
{
|
||||
|
@ -35,6 +36,19 @@ namespace SourcemapToolkit.SourcemapParser
|
|||
/// </summary>
|
||||
public List<MappingEntry> ParsedMappings;
|
||||
|
||||
public SourceMap Clone()
|
||||
{
|
||||
return new SourceMap
|
||||
{
|
||||
Version = this.Version,
|
||||
File = this.File,
|
||||
Mappings = this.Mappings,
|
||||
Sources = new List<string>(this.Sources),
|
||||
Names = new List<string>(this.Names),
|
||||
ParsedMappings = new List<MappingEntry>(this.ParsedMappings.Select(m => m.Clone()))
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the mappings of a sub source map to the current source map
|
||||
/// Each mapping to the supplied source file is rewritten using the supplied source map
|
||||
|
|
Загрузка…
Ссылка в новой задаче