log-rune
Dominic Gannaway 10 months ago
parent 22b5289a42
commit f2162c0c26

@ -299,28 +299,41 @@ export const javascript_visitors_runes = {
return b.call('$.effect_active'); return b.call('$.effect_active');
} }
if (rune === '$log') { if (rune === '$log') {
const args = /** @type {import('estree').Expression[]} */ ( if (state.options.dev) {
node.arguments.map((arg) => visit(arg)) const args = /** @type {import('estree').Expression[]} */ (
); node.arguments.map((arg) => visit(arg))
return b.call('$.log', b.thunk(b.array(args))); );
return b.call('$.log', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
} }
if (rune === '$log.trace') { if (rune === '$log.trace') {
const args = /** @type {import('estree').Expression[]} */ ( if (state.options.dev) {
node.arguments.map((arg) => visit(arg)) const args = /** @type {import('estree').Expression[]} */ (
); node.arguments.map((arg) => visit(arg))
return b.call('$.log_trace', b.thunk(b.array(args))); );
return b.call('$.log_trace', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
} }
if (rune === '$log.break') { if (rune === '$log.break') {
const args = /** @type {import('estree').Expression[]} */ ( if (state.options.dev) {
node.arguments.map((arg) => visit(arg)) const args = /** @type {import('estree').Expression[]} */ (
); node.arguments.map((arg) => visit(arg))
return b.call('$.log_break', b.thunk(b.array(args))); );
return b.call('$.log_break', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
} }
if (rune === '$log.table') { if (rune === '$log.table') {
const args = /** @type {import('estree').Expression[]} */ ( if (state.options.dev) {
node.arguments.map((arg) => visit(arg)) const args = /** @type {import('estree').Expression[]} */ (
); node.arguments.map((arg) => visit(arg))
return b.call('$.log_table', b.thunk(b.array(args))); );
return b.call('$.log_table', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
} }
next(); next();

@ -205,15 +205,20 @@
return { return {
from: word.from - 1, from: word.from - 1,
options: [ options: [
{ label: '$state', type: 'keyword', boost: 5 }, { label: '$state', type: 'keyword', boost: 10 },
{ label: '$props', type: 'keyword', boost: 4 }, { label: '$props', type: 'keyword', boost: 9 },
{ label: '$derived', type: 'keyword', boost: 3 }, { label: '$derived', type: 'keyword', boost: 8 },
snip('$effect(() => {\n\t${}\n});', { label: '$effect', type: 'keyword', boost: 2 }), snip('$effect(() => {\n\t${}\n});', { label: '$effect', type: 'keyword', boost: 7 }),
snip('$effect.pre(() => {\n\t${}\n});', { snip('$effect.pre(() => {\n\t${}\n});', {
label: '$effect.pre', label: '$effect.pre',
type: 'keyword', type: 'keyword',
boost: 1 boost: 6
}) });
{ label: '$effect.active', type: 'keyword', boost: 5 },
{ label: '$log', type: 'keyword', boost: 4 },
{ label: '$log.break', type: 'keyword', boost: 3 },
{ label: '$log.trace', type: 'keyword', boost: 2 },
{ label: '$log.table', type: 'keyword', boost: 1 },
] ]
}; };
} }

Loading…
Cancel
Save