Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/flo-bit/shapecraft. flo-bit.dev/shapecraft
Something went wrong. Try again.
650 B · 41 lines
JavaScript
at commit 049ef598
123456789101112131415161718192021222324252627282930313233343536373839404142import Node from '../core/Node.js';import { nodeProxy } from '../tsl/TSLCore.js';
class ExpressionNode extends Node {
static get type() {
return 'ExpressionNode';
}
constructor( snippet = '', nodeType = 'void' ) {
super( nodeType );
this.snippet = snippet;
}
generate( builder, output ) {
const type = this.getNodeType( builder ); const snippet = this.snippet;
if ( type === 'void' ) {
builder.addLineFlowCode( snippet, this );
} else {
return builder.format( `( ${ snippet } )`, type, output );
}
}
}
export default ExpressionNode;
export const expression = /*@__PURE__*/ nodeProxy( ExpressionNode );