if block expressions

pull/31/head
Rich-Harris 8 years ago
parent c1204e57b0
commit 49a6aeb190

@ -65,8 +65,7 @@ export default function generate ( parsed, template ) {
each: 0
};
// TODO add contents of <script> tag, with `export default` replaced with `var template =`
// TODO css
// TODO (scoped) css
let current = {
useAnchor: false,
@ -85,18 +84,6 @@ export default function generate ( parsed, template ) {
parent: null
};
function flattenExpression ( node, contexts ) {
const flattened = flattenReference( node );
if ( flattened ) {
if ( flattened.name in contexts ) return flattened.keypath;
// TODO handle globals, e.g. {{Math.round(foo)}}
return `root.${flattened.keypath}`;
}
return 'TODO';
}
parsed.html.children.forEach( child => {
walkHtml( child, {
Element: {
@ -398,6 +385,7 @@ export default function generate ( parsed, template ) {
name: renderer,
target: 'target',
contexts: current.contexts,
contextChain: current.contextChain,
initStatements: [],

@ -15,6 +15,8 @@ export default function contextualise ( code, expression, contexts ) {
code.insertRight( node.start, `root.` );
if ( !~usedContexts.indexOf( 'root' ) ) usedContexts.push( 'root' );
}
this.skip();
}
}
});

Loading…
Cancel
Save