blob: c1f6e3a4e9837b1e883aacbe0df630bec5703841 (
plain) (
tree)
|
|
import { SourceRange, SourceSnippet } from './types';
import { utils } from './utils';
/**
* Gets the source range snippet by source range to be used by revert trace.
* @param sourceRange source range
* @param sourceCode source code
*/
export function getSourceRangeSnippet(sourceRange: SourceRange, sourceCode: string): SourceSnippet {
const sourceCodeInRange = utils.getRange(sourceCode, sourceRange.location);
return {
range: sourceRange.location,
source: sourceCodeInRange,
fileName: sourceRange.fileName,
};
}
|