2022-02-12 19:54:08 +03:30
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Error.h>
|
2023-02-16 11:03:49 -05:00
|
|
|
#include <AK/String.h>
|
2022-02-12 19:54:08 +03:30
|
|
|
#include <AK/StringView.h>
|
|
|
|
#include <LibJS/Forward.h>
|
|
|
|
|
|
|
|
namespace JS::Bytecode {
|
|
|
|
|
2025-07-19 10:41:08 -07:00
|
|
|
struct CodeGenerationError {
|
2022-02-12 19:54:08 +03:30
|
|
|
ASTNode const* failing_node { nullptr };
|
|
|
|
StringView reason_literal;
|
|
|
|
|
2023-02-16 11:03:49 -05:00
|
|
|
ErrorOr<String> to_string() const;
|
2022-02-12 19:54:08 +03:30
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
using CodeGenerationErrorOr = ErrorOr<T, CodeGenerationError>;
|
|
|
|
|
|
|
|
}
|