Block.cpp 649 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <AK/String.h>
  7. #include <LibJS/Bytecode/Block.h>
  8. #include <LibJS/Bytecode/Instruction.h>
  9. namespace JS::Bytecode {
  10. NonnullOwnPtr<Block> Block::create()
  11. {
  12. return adopt_own(*new Block);
  13. }
  14. Block::Block()
  15. {
  16. }
  17. Block::~Block()
  18. {
  19. }
  20. void Block::append(Badge<Bytecode::Generator>, NonnullOwnPtr<Instruction> instruction)
  21. {
  22. m_instructions.append(move(instruction));
  23. }
  24. void Block::dump() const
  25. {
  26. for (size_t i = 0; i < m_instructions.size(); ++i) {
  27. warnln("[{:3}] {}", i, m_instructions[i].to_string());
  28. }
  29. }
  30. }