CodeGenerationError.h 492 B

1234567891011121314151617181920212223242526
  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/String.h>
  9. #include <AK/StringView.h>
  10. #include <LibJS/Forward.h>
  11. namespace JS::Bytecode {
  12. struct CodeGenerationError {
  13. ASTNode const* failing_node { nullptr };
  14. StringView reason_literal;
  15. ErrorOr<String> to_string() const;
  16. };
  17. template<typename T>
  18. using CodeGenerationErrorOr = ErrorOr<T, CodeGenerationError>;
  19. }