three
Version:
JavaScript 3D library
33 lines (17 loc) • 463 B
JavaScript
import Node from './Node.js';
class ExpressionNode extends Node {
constructor( snipped = '', nodeType = 'void' ) {
super( nodeType );
this.snipped = snipped;
}
generate( builder, output ) {
const type = this.getNodeType( builder );
const snipped = this.snipped;
if ( type === 'void' ) {
builder.addFlowCode( snipped );
} else {
return builder.format( `( ${ snipped } )`, type, output );
}
}
}
export default ExpressionNode;