CodeGenerationError.h 454 B

12345678910111213141516171819202122232425
  1. /*
  2. * Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Error.h>
  8. #include <AK/StringView.h>
  9. #include <LibJS/Forward.h>
  10. namespace JS::Bytecode {
  11. struct CodeGenerationError {
  12. ASTNode const* failing_node { nullptr };
  13. StringView reason_literal;
  14. String to_string();
  15. };
  16. template<typename T>
  17. using CodeGenerationErrorOr = ErrorOr<T, CodeGenerationError>;
  18. }