From 865a184adc070b752523db68c57a46e549b71970 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Fri, 16 Dec 2016 00:05:46 -0500 Subject: [PATCH] sort methods --- src/generators/Generator.js | 68 ++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/generators/Generator.js b/src/generators/Generator.js index b5c467ece0..2d18758c4c 100644 --- a/src/generators/Generator.js +++ b/src/generators/Generator.js @@ -45,40 +45,6 @@ export default class Generator { } } - createMountStatement ( name ) { - if ( this.current.target === 'target' ) { - this.current.builders.mount.addLine( - `target.insertBefore( ${name}, anchor );` - ); - } else { - this.current.builders.init.addLine( - `${this.current.target}.appendChild( ${name} );` ); - } - } - - createAnchor ( _name, description = '' ) { - const name = `${_name}_anchor`; - const statement = `document.createComment( ${JSON.stringify( description )} )`; - this.addElement( name, statement, true ); - return name; - } - - generateBlock ( node, name ) { - this.push({ - name, - target: 'target', - localElementDepth: 0, - builders: this.getBuilders(), - getUniqueName: this.getUniqueNameMaker() - }); - // walk the children here - node.children.forEach( node => this.visit( node ) ); - this.addRenderer( this.current ); - this.pop(); - // unset the children, to avoid them being visited again - node.children = []; - } - addRenderer ( fragment ) { if ( fragment.autofocus ) { fragment.builders.init.addLine( `${fragment.autofocus}.focus();` ); @@ -181,6 +147,40 @@ export default class Generator { }; } + createAnchor ( _name, description = '' ) { + const name = `${_name}_anchor`; + const statement = `document.createComment( ${JSON.stringify( description )} )`; + this.addElement( name, statement, true ); + return name; + } + + createMountStatement ( name ) { + if ( this.current.target === 'target' ) { + this.current.builders.mount.addLine( + `target.insertBefore( ${name}, anchor );` + ); + } else { + this.current.builders.init.addLine( + `${this.current.target}.appendChild( ${name} );` ); + } + } + + generateBlock ( node, name ) { + this.push({ + name, + target: 'target', + localElementDepth: 0, + builders: this.getBuilders(), + getUniqueName: this.getUniqueNameMaker() + }); + // walk the children here + node.children.forEach( node => this.visit( node ) ); + this.addRenderer( this.current ); + this.pop(); + // unset the children, to avoid them being visited again + node.children = []; + } + getBuilders () { return { init: new CodeBuilder(),