ci failures. clutching at straws

pull/4078/head
Rich Harris 5 years ago
parent a7db99e2f6
commit b43762d3a8

@ -1,5 +1,6 @@
**/_actual.js **/_actual.js
**/expected.js **/expected.js
**/_output/**.js
test/*/samples/*/output.js test/*/samples/*/output.js
node_modules node_modules

6
package-lock.json generated

@ -500,9 +500,9 @@
"dev": true "dev": true
}, },
"code-red": { "code-red": {
"version": "0.0.26", "version": "0.0.27",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-0.0.26.tgz", "resolved": "https://registry.npmjs.org/code-red/-/code-red-0.0.27.tgz",
"integrity": "sha512-W4t68vk3xJjmkbuAKfEtaj7E+K82BtV+A4VjBlxHA6gDoSLc+sTB643JdJMSk27vpp5iEqHFuGnHieQGy/GmUQ==", "integrity": "sha512-MSILIi8kkSGag76TW+PRfBP/dN++Ei+uTeiUfqW4Es5teFNrbsAWtyAbPwxKI1vxEsBx64loAfGxS1kVCo1d2g==",
"dev": true, "dev": true,
"requires": { "requires": {
"acorn": "^7.1.0", "acorn": "^7.1.0",

@ -64,7 +64,7 @@
"acorn": "^7.1.0", "acorn": "^7.1.0",
"agadoo": "^1.1.0", "agadoo": "^1.1.0",
"c8": "^5.0.1", "c8": "^5.0.1",
"code-red": "0.0.26", "code-red": "0.0.27",
"codecov": "^3.5.0", "codecov": "^3.5.0",
"css-tree": "1.0.0-alpha22", "css-tree": "1.0.0-alpha22",
"eslint": "^6.3.0", "eslint": "^6.3.0",

@ -31,62 +31,45 @@ export function get_slot_definition(block: Block, scope: TemplateScope, lets: Le
const { context_lookup } = block.renderer; const { context_lookup } = block.renderer;
let expression;
// i am well aware that this code is gross // i am well aware that this code is gross
// TODO make it less gross // TODO make it less gross
const changes = { const changes = {
get type() { type: 'ParenthesizedExpression',
if (block.renderer.context_overflow) return 'ArrayExpression'; get expression() {
if (block.renderer.context_overflow) {
const grouped = [];
expression = Array.from(names) Array.from(names).forEach(name => {
.map(name => {
const i = context_lookup.get(name).index.value as number; const i = context_lookup.get(name).index.value as number;
return x`${name} ? ${1 << i} : 0`; const g = Math.floor(i / 31);
})
.reduce((lhs, rhs) => x`${lhs} | ${rhs}`) as BinaryExpression;
return expression.type;
},
get elements() {
const grouped = [];
Array.from(names).forEach(name => { if (!grouped[g]) grouped[g] = [];
const i = context_lookup.get(name).index.value as number; grouped[g].push({ name, n: i % 31 });
const g = Math.floor(i / 31); });
if (!grouped[g]) grouped[g] = []; const elements = [];
grouped[g].push({ name, n: i % 31 });
});
const elements = []; for (let g = 0; g < grouped.length; g += 1) {
elements[g] = grouped[g]
? grouped[g]
.map(({ name, n }) => x`${name} ? ${1 << n} : 0`)
.reduce((lhs, rhs) => x`${lhs} | ${rhs}`)
: x`0`;
}
for (let g = 0; g < grouped.length; g += 1) { return {
elements[g] = grouped[g] type: 'ArrayExpression',
? grouped[g] elements
.map(({ name, n }) => x`${name} ? ${1 << n} : 0`) };
.reduce((lhs, rhs) => x`${lhs} | ${rhs}`)
: x`0`;
} }
return elements; return Array.from(names)
}, .map(name => {
get test() { const i = context_lookup.get(name).index.value as number;
return expression.test; return x`${name} ? ${1 << i} : 0`;
}, })
get consequent() { .reduce((lhs, rhs) => x`${lhs} | ${rhs}`) as BinaryExpression;
return expression.consequent; }
},
get alternate() {
return expression.alternate;
},
get left() {
return expression.left;
},
get right() {
return expression.right;
},
operator: '|'
}; };
return { return {

Loading…
Cancel
Save