|
|
@ -2,7 +2,6 @@ import Let from '../../../nodes/Let';
|
|
|
|
import { x, p } from 'code-red';
|
|
|
|
import { x, p } from 'code-red';
|
|
|
|
import Block from '../../Block';
|
|
|
|
import Block from '../../Block';
|
|
|
|
import TemplateScope from '../../../nodes/shared/TemplateScope';
|
|
|
|
import TemplateScope from '../../../nodes/shared/TemplateScope';
|
|
|
|
import { BinaryExpression } from 'estree';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function get_slot_definition(block: Block, scope: TemplateScope, lets: Let[]) {
|
|
|
|
export function get_slot_definition(block: Block, scope: TemplateScope, lets: Let[]) {
|
|
|
|
if (lets.length === 0) return { block, scope };
|
|
|
|
if (lets.length === 0) return { block, scope };
|
|
|
@ -36,7 +35,6 @@ export function get_slot_definition(block: Block, scope: TemplateScope, lets: Le
|
|
|
|
const changes = {
|
|
|
|
const changes = {
|
|
|
|
type: 'ParenthesizedExpression',
|
|
|
|
type: 'ParenthesizedExpression',
|
|
|
|
get expression() {
|
|
|
|
get expression() {
|
|
|
|
if (block.renderer.context_overflow) {
|
|
|
|
|
|
|
|
const grouped = [];
|
|
|
|
const grouped = [];
|
|
|
|
|
|
|
|
|
|
|
|
Array.from(names).forEach(name => {
|
|
|
|
Array.from(names).forEach(name => {
|
|
|
@ -62,14 +60,6 @@ export function get_slot_definition(block: Block, scope: TemplateScope, lets: Le
|
|
|
|
elements
|
|
|
|
elements
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Array.from(names)
|
|
|
|
|
|
|
|
.map(name => {
|
|
|
|
|
|
|
|
const i = context_lookup.get(name).index.value as number;
|
|
|
|
|
|
|
|
return x`${name} ? ${1 << i} : 0`;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.reduce((lhs, rhs) => x`${lhs} | ${rhs}`) as BinaryExpression;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|