Node.js 688 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { NodeUpdateType } from './constants.js';
  2. class Node {
  3. constructor( type = null ) {
  4. this.type = type;
  5. this.updateType = NodeUpdateType.None;
  6. }
  7. getUpdateType( /*builder*/ ) {
  8. return this.updateType;
  9. }
  10. getType( /*builder*/ ) {
  11. return this.type;
  12. }
  13. getTypeLength( builder ) {
  14. return builder.getTypeLength( this.getType( builder ) );
  15. }
  16. update( /*frame*/ ) {
  17. console.warn( 'Abstract function.' );
  18. }
  19. generate( /*builder, output*/ ) {
  20. console.warn( 'Abstract function.' );
  21. }
  22. build( builder, output = null ) {
  23. builder.addNode( this );
  24. return this.generate( builder, output );
  25. }
  26. }
  27. Node.prototype.isNode = true;
  28. export default Node;