remove getBuilders

pull/453/head
Rich-Harris 8 years ago
parent cc2b6fd53b
commit cca91f88bb

@ -1,5 +1,7 @@
import CodeBuilder from '../../utils/CodeBuilder.js';
export default class Fragment { export default class Fragment {
constructor ({ generator, name, key, expression, context, contextDependencies, component, contexts, indexes, params, indexNames, listNames, builders, getUniqueName }) { constructor ({ generator, name, key, expression, context, contextDependencies, component, contexts, indexes, params, indexNames, listNames, getUniqueName }) {
this.generator = generator; this.generator = generator;
this.name = name; this.name = name;
this.key = key; this.key = key;
@ -16,7 +18,14 @@ export default class Fragment {
this.indexNames = indexNames; this.indexNames = indexNames;
this.listNames = listNames; this.listNames = listNames;
this.builders = builders; this.builders = {
create: new CodeBuilder(),
mount: new CodeBuilder(),
update: new CodeBuilder(),
detach: new CodeBuilder(),
detachRaw: new CodeBuilder(),
destroy: new CodeBuilder()
};
this.getUniqueName = getUniqueName; this.getUniqueName = getUniqueName;
} }

@ -1,5 +1,4 @@
import deindent from '../../utils/deindent.js'; import deindent from '../../utils/deindent.js';
import getBuilders from './utils/getBuilders.js';
import CodeBuilder from '../../utils/CodeBuilder.js'; import CodeBuilder from '../../utils/CodeBuilder.js';
import visit from './visit.js'; import visit from './visit.js';
import Generator from '../Generator.js'; import Generator from '../Generator.js';
@ -122,7 +121,6 @@ export default function dom ( parsed, source, options ) {
indexNames: new Map(), indexNames: new Map(),
listNames: new Map(), listNames: new Map(),
builders: getBuilders(),
getUniqueName getUniqueName
}); });

@ -1,12 +0,0 @@
import CodeBuilder from '../../../utils/CodeBuilder.js';
export default function getBuilders () {
return {
create: new CodeBuilder(),
mount: new CodeBuilder(),
update: new CodeBuilder(),
detach: new CodeBuilder(),
detachRaw: new CodeBuilder(),
destroy: new CodeBuilder()
};
}

@ -1,6 +1,5 @@
import deindent from '../../../utils/deindent.js'; import deindent from '../../../utils/deindent.js';
import CodeBuilder from '../../../utils/CodeBuilder.js'; import CodeBuilder from '../../../utils/CodeBuilder.js';
import getBuilders from '../utils/getBuilders.js';
import visit from '../visit.js'; import visit from '../visit.js';
import addComponentAttributes from './attributes/addComponentAttributes.js'; import addComponentAttributes from './attributes/addComponentAttributes.js';
@ -79,8 +78,7 @@ export default function visitComponent ( generator, fragment, state, node ) {
const params = fragment.params.join( ', ' ); const params = fragment.params.join( ', ' );
const childFragment = fragment.child({ const childFragment = fragment.child({
name: generator.getUniqueName( `render_${name}_yield_fragment` ), // TODO should getUniqueName happen inside Fragment? probably name: generator.getUniqueName( `render_${name}_yield_fragment` ) // TODO should getUniqueName happen inside Fragment? probably
builders: getBuilders()
}); });
const childState = Object.assign( {}, state, { const childState = Object.assign( {}, state, {

@ -1,6 +1,5 @@
import CodeBuilder from '../../../utils/CodeBuilder.js'; import CodeBuilder from '../../../utils/CodeBuilder.js';
import deindent from '../../../utils/deindent.js'; import deindent from '../../../utils/deindent.js';
import getBuilders from '../utils/getBuilders.js';
import visit from '../visit.js'; import visit from '../visit.js';
export default function visitEachBlock ( generator, fragment, state, node ) { export default function visitEachBlock ( generator, fragment, state, node ) {
@ -204,7 +203,6 @@ export default function visitEachBlock ( generator, fragment, state, node ) {
listNames, listNames,
params: blockParams, params: blockParams,
builders: getBuilders(),
getUniqueName getUniqueName
}); });
@ -221,7 +219,6 @@ export default function visitEachBlock ( generator, fragment, state, node ) {
if ( node.else ) { if ( node.else ) {
const childFragment = fragment.child({ const childFragment = fragment.child({
name: renderElse, name: renderElse,
builders: getBuilders(),
getUniqueName: generator.getUniqueNameMaker( fragment.params ) getUniqueName: generator.getUniqueNameMaker( fragment.params )
}); });

@ -1,5 +1,4 @@
import deindent from '../../../utils/deindent.js'; import deindent from '../../../utils/deindent.js';
import getBuilders from '../utils/getBuilders.js';
import visit from '../visit.js'; import visit from '../visit.js';
function getConditionsAndBlocks ( generator, fragment, state, node, _name, i = 0 ) { function getConditionsAndBlocks ( generator, fragment, state, node, _name, i = 0 ) {
@ -34,8 +33,7 @@ function getConditionsAndBlocks ( generator, fragment, state, node, _name, i = 0
function generateBlock ( generator, fragment, state, node, name ) { function generateBlock ( generator, fragment, state, node, name ) {
const childFragment = fragment.child({ const childFragment = fragment.child({
name, name
builders: getBuilders()
}); });
const childState = Object.assign( {}, state, { const childState = Object.assign( {}, state, {

Loading…
Cancel
Save