mirror of https://github.com/sveltejs/svelte
18 lines
376 B
18 lines
376 B
import { Node } from '../interfaces';
|
|
|
|
export const UNKNOWN = {};
|
|
|
|
export function gatherPossibleValues(node: Node, set: Set<string|{}>) {
|
|
if (node.type === 'Literal') {
|
|
set.add(node.value);
|
|
}
|
|
|
|
else if (node.type === 'ConditionalExpression') {
|
|
gatherPossibleValues(node.consequent, set);
|
|
gatherPossibleValues(node.alternate, set);
|
|
}
|
|
|
|
else {
|
|
set.add(UNKNOWN);
|
|
}
|
|
} |