mirror of https://github.com/sveltejs/svelte
pull/8569/head
parent
64e1509d27
commit
99a108d920
@ -1,17 +1,21 @@
|
||||
import ConstTag from '../../../nodes/ConstTag';
|
||||
|
||||
export function get_const_tags(const_tags: ConstTag[]) {
|
||||
if (const_tags.length === 0) return null;
|
||||
return {
|
||||
type: 'VariableDeclaration',
|
||||
kind: 'let',
|
||||
declarations: const_tags.map((const_tag) => {
|
||||
const assignment = const_tag.node.expression;
|
||||
return {
|
||||
type: 'VariableDeclarator',
|
||||
id: assignment.left,
|
||||
init: assignment.right
|
||||
};
|
||||
})
|
||||
};
|
||||
/** @param {ConstTag[]} const_tags */
|
||||
export function get_const_tags(const_tags) {
|
||||
if (const_tags.length === 0)
|
||||
return null;
|
||||
return {
|
||||
type: 'VariableDeclaration',
|
||||
kind: 'let',
|
||||
declarations: const_tags.map((const_tag) => {
|
||||
const assignment = const_tag.node.expression;
|
||||
return {
|
||||
type: 'VariableDeclarator',
|
||||
id: assignment.left,
|
||||
init: assignment.right
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in new issue