remove some unused code

pull/802/head
Rich Harris 7 years ago
parent 7a9ac95b34
commit 587d1f8994

@ -341,8 +341,7 @@ const preprocessors = {
node._state = getChildState(state, {
name,
parentNode: `${name}._slotted.default`,
isYield: true
parentNode: `${name}._slotted.default`
});
} else {
const slot = getStaticAttributeValue(node, 'slot');
@ -373,12 +372,7 @@ const preprocessors = {
if (node.children.length) {
if (isComponent) {
const name = block.getUniqueName(
(node.name === ':Self' ? generator.name : node.name).toLowerCase()
);
if (node.children) node._slots = new Set(['default']); // TODO only include default if there are unslotted children
if (node.children) node._slots = new Set(['default']);
preprocessChildren(generator, block, node._state, node, inEachBlock, elementStack, componentStack.concat(node), stripWhitespace, nextSibling);
} else {
if (node.name === 'pre' || node.name === 'textarea') stripWhitespace = false;

@ -208,17 +208,6 @@ export default function visitElement(
}
if (node.initialUpdate) {
// special case — if we're in a yield block, then we may call mount
// long after the fragment is created. We may therefore need to get
// the latest `state` object
// TODO what about contexts in yield blocks? do we need to do
// `var ${contextName} = [something complicated]`?
const needsStateObject = node.initialUpdateNeedsStateObject && state.isYield;
if ( needsStateObject ) {
block.builders.mount.addLine(`var state = #component.get()`);
}
block.builders.mount.addBlock(node.initialUpdate);
}

@ -11,7 +11,6 @@ import { stringify } from '../../utils/stringify';
export class SsrGenerator extends Generator {
bindings: string[];
renderCode: string;
elementDepth: number; // TODO is this necessary? appears to be unused
appendTargets: Record<string, string> | null;
appendTarget: string | null;
@ -25,7 +24,6 @@ export class SsrGenerator extends Generator {
super(parsed, source, name, stylesheet, options);
this.bindings = [];
this.renderCode = '';
this.elementDepth = 0;
this.appendTargets = null;
// in an SSR context, we don't need to include events, methods, oncreate or ondestroy

@ -83,14 +83,10 @@ export default function visitComponent(
generator.appendTargets = {};
generator.setAppendTarget('default');
generator.elementDepth += 1;
node.children.forEach((child: Node) => {
visit(generator, block, child);
});
generator.elementDepth -= 1;
const slotted = Object.keys(generator.appendTargets)
.map(name => `${name}: () => \`${generator.appendTargets[name]}\``)
.join(', ');

@ -83,13 +83,9 @@ export default function visitElement(
if (node.name === 'textarea' && textareaContents !== undefined) {
generator.append(textareaContents);
} else {
generator.elementDepth += 1;
node.children.forEach((child: Node) => {
visit(generator, block, child);
});
generator.elementDepth -= 1;
}
if (!isVoidElementName(node.name)) {

@ -14,13 +14,9 @@ export default function visitSlot(
generator.append(`\${options && options.slotted && options.slotted.${slotName} ? options.slotted.${slotName}() : \``);
generator.elementDepth += 1;
node.children.forEach((child: Node) => {
visit(generator, block, child);
});
generator.elementDepth -= 1;
generator.append(`\`}`);
}

Loading…
Cancel
Save