/* * Copyright (c) 2023, Dan Klishch * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include "CompilationPipeline.h" namespace JSSpecCompiler { class CppASTConverter { public: CppASTConverter(RefPtr const& function) : m_function(function) { } NonnullRefPtr convert(); private: template NullableTree convert_node(T const&); NullableTree as_nullable_tree(Cpp::Statement const* statement); Tree as_tree(Cpp::Statement const* statement); Tree as_possibly_empty_tree(Cpp::Statement const* statement); RefPtr m_function; }; class CppParsingStep : public CompilationStep { public: CppParsingStep(); ~CppParsingStep(); void run(TranslationUnitRef translation_unit) override; private: OwnPtr m_parser; ByteBuffer m_input; }; }