mirror of https://github.com/sveltejs/svelte
parent
0fe16c8ecd
commit
ac1be5def2
@ -1,9 +1,12 @@
|
||||
import { Node } from '../interfaces';
|
||||
|
||||
export default function getTailSnippet(node: Node) {
|
||||
const end = node.end;
|
||||
while (node.type === 'MemberExpression') node = node.object;
|
||||
const start = node.end;
|
||||
|
||||
export function get_tail_snippet(node: Node) {
|
||||
const { start, end } = get_tail(node);
|
||||
return `[✂${start}-${end}✂]`;
|
||||
}
|
||||
|
||||
export function get_tail(node: Node) {
|
||||
const end = node.end;
|
||||
while (node.type === 'MemberExpression') node = node.object;
|
||||
return { start: node.end, end };
|
||||
}
|
Loading…
Reference in new issue