You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

50 lines
662 B

import Node from './Node.js';
class CodeNode extends Node {
constructor( code = '', includes = [] ) {
super( 'code' );
this.isCodeNode = true;
this.code = code;
this._includes = includes;
}
setIncludes( includes ) {
this._includes = includes;
return this;
}
getIncludes( /*builder*/ ) {
return this._includes;
}
generate( builder ) {
const includes = this.getIncludes( builder );
for ( const include of includes ) {
include.build( builder );
}
const nodeCode = builder.getCodeFromNode( this, this.getNodeType( builder ) );
nodeCode.code = this.code;
return nodeCode.code;
}
}
export default CodeNode;