Skip to content

Commit

Permalink
refactor(reflect): rename reflect_impl.h2 to reflect.h2
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Jan 2, 2024
1 parent 2583d41 commit 1817e9c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
118 changes: 59 additions & 59 deletions source/reflect_impl.h → source/reflect.h
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@

#ifndef REFLECT_IMPL_H_CPP2
#define REFLECT_IMPL_H_CPP2
#ifndef REFLECT_H_CPP2
#define REFLECT_H_CPP2


//=== Cpp2 type declarations ====================================================


#include "cpp2util.h"

#line 1 "reflect_impl.h2"
#line 1 "reflect.h2"

#line 31 "reflect_impl.h2"
#line 31 "reflect.h2"
namespace cpp2 {

namespace meta {

#line 44 "reflect_impl.h2"
#line 44 "reflect.h2"
class dll_symbol;


#line 100 "reflect_impl.h2"
#line 100 "reflect.h2"
namespace this_execution
{

#line 116 "reflect_impl.h2"
#line 116 "reflect.h2"
}

#line 123 "reflect_impl.h2"
#line 123 "reflect.h2"
class diagnostic;


#line 127 "reflect_impl.h2"
#line 127 "reflect.h2"
template<typename T> class expected;


#line 144 "reflect_impl.h2"
#line 144 "reflect.h2"
}

}

#line 402 "reflect_impl.h2"
#line 402 "reflect.h2"
namespace cpp2 {

namespace meta {

#line 414 "reflect_impl.h2"
#line 414 "reflect.h2"
class compiler_services_data;

#line 627 "reflect_impl.h2"
#line 627 "reflect.h2"
}

}


//=== Cpp2 type definitions and function declarations ===========================

#line 1 "reflect_impl.h2"
#line 1 "reflect.h2"

// Copyright (c) Herb Sutter
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
Expand Down Expand Up @@ -85,15 +85,15 @@ class compiler_services_data;
#include <dlfcn.h>
#endif // _WIN32

#line 31 "reflect_impl.h2"
#line 31 "reflect.h2"
namespace cpp2 {

namespace meta {

#line 36 "reflect_impl.h2"
#line 36 "reflect.h2"
[[nodiscard]] auto to_type_metafunction_cast(cpp2::in<std::string_view> name) -> std::string;

#line 40 "reflect_impl.h2"
#line 40 "reflect.h2"
//-----------------------------------------------------------------------
//
// dll_symbol
Expand All @@ -108,17 +108,17 @@ class dll_symbol {
public: dll_symbol();
public: explicit dll_symbol(cpp2::in<declaration_node> n, cpp2::in<bool> is_reachable_);

#line 66 "reflect_impl.h2"
#line 66 "reflect.h2"
public: explicit dll_symbol(std::string_view s);
#line 66 "reflect_impl.h2"
#line 66 "reflect.h2"
public: auto operator=(std::string_view s) -> dll_symbol& ;

#line 74 "reflect_impl.h2"
#line 74 "reflect.h2"
public: [[nodiscard]] auto c_str() const& -> char const*;
public: [[nodiscard]] auto view() const& -> std::string_view;
public: [[nodiscard]] auto without_prefix() const& -> std::string_view;

#line 89 "reflect_impl.h2"
#line 89 "reflect.h2"
public: [[nodiscard]] auto is_reachable() const& -> bool;
public: [[nodiscard]] auto is_const_metafunction() const& -> bool;
public: [[nodiscard]] auto operator<=>(dll_symbol const& that) const& -> std::strong_ordering = default;
Expand All @@ -128,23 +128,23 @@ public: auto operator=(dll_symbol const& that) -> dll_symbol& ;
public: dll_symbol(dll_symbol&& that) noexcept;
public: auto operator=(dll_symbol&& that) noexcept -> dll_symbol& ;

#line 94 "reflect_impl.h2"
#line 94 "reflect.h2"
};

[[nodiscard]] auto symbols_accessor(cpp2::in<std::string_view> lib_path) -> dll_symbol;

#line 100 "reflect_impl.h2"
#line 100 "reflect.h2"
namespace this_execution
{

// The environment variable 'CPPFRONT_METAFUNCTION_LIBRARY'
// is read and interpreted as the Cpp2 metafunction library path of this execution
[[nodiscard]] auto symbols_accessor() -> dll_symbol;

#line 116 "reflect_impl.h2"
#line 116 "reflect.h2"
}

#line 119 "reflect_impl.h2"
#line 119 "reflect.h2"
//-----------------------------------------------------------------------
//
// expected with diagnostic to return to apply_metafunctions
Expand All @@ -155,12 +155,12 @@ class diagnostic {

template<typename T> class expected {

#line 131 "reflect_impl.h2"
#line 131 "reflect.h2"
public: expected(T const& v);
#line 131 "reflect_impl.h2"
#line 131 "reflect.h2"
public: auto operator=(T const& v) -> expected& ;
public: expected(cpp2::in<diagnostic> u);
#line 132 "reflect_impl.h2"
#line 132 "reflect.h2"
public: auto operator=(cpp2::in<diagnostic> u) -> expected& ;

public: template<typename F> [[nodiscard]] auto and_then(F const& f) && -> std::remove_cvref_t<std::invoke_result_t<F,T>>;
Expand All @@ -183,7 +183,7 @@ public: expected(expected&& that) noexcept;
public: auto operator=(expected const& that) -> expected& ;
public: auto operator=(expected&& that) noexcept -> expected& ;

#line 142 "reflect_impl.h2"
#line 142 "reflect.h2"
};

}
Expand Down Expand Up @@ -443,12 +443,12 @@ auto load_metafunction(

}

#line 402 "reflect_impl.h2"
#line 402 "reflect.h2"
namespace cpp2 {

namespace meta {

#line 407 "reflect_impl.h2"
#line 407 "reflect.h2"
//-----------------------------------------------------------------------
//
// Compiler services data
Expand Down Expand Up @@ -476,10 +476,10 @@ class compiler_services_data
cpp2::in<bool> source_has_source_interface
) -> compiler_services_data;

#line 440 "reflect_impl.h2"
#line 440 "reflect.h2"
};

#line 443 "reflect_impl.h2"
#line 443 "reflect.h2"
//-----------------------------------------------------------------------
//
// apply_metafunctions
Expand All @@ -491,14 +491,14 @@ class compiler_services_data
auto const& lookup
) -> bool;

#line 561 "reflect_impl.h2"
#line 561 "reflect.h2"
[[nodiscard]] auto apply_metafunctions(
declaration_node& n,
function_declaration& rfunction,
auto const& error
) -> bool;

#line 627 "reflect_impl.h2"
#line 627 "reflect.h2"
}

}
Expand All @@ -509,18 +509,18 @@ class compiler_services_data

//=== Cpp2 function definitions =================================================

#line 1 "reflect_impl.h2"
#line 1 "reflect.h2"

#line 31 "reflect_impl.h2"
#line 31 "reflect.h2"
namespace cpp2 {

namespace meta {

#line 36 "reflect_impl.h2"
#line 36 "reflect.h2"
[[nodiscard]] auto to_type_metafunction_cast(cpp2::in<std::string_view> name) -> std::string {
return "static_cast<void(*)(cpp2::meta::type_declaration&)>(" + cpp2::to_string(name) + ")"; }

#line 47 "reflect_impl.h2"
#line 47 "reflect.h2"
inline CPP2_CONSTEXPR std::string_view dll_symbol::constant_prefix = "cpp2_metafunction_";
inline CPP2_CONSTEXPR std::string_view dll_symbol::reachable_mangle = "r";
inline CPP2_CONSTEXPR std::string_view dll_symbol::const_metafunction_mangle = "c";
Expand All @@ -529,14 +529,14 @@ namespace meta {
dll_symbol::dll_symbol(cpp2::in<declaration_node> n, cpp2::in<bool> is_reachable_)
: value{ constant_prefix }

#line 56 "reflect_impl.h2"
#line 56 "reflect.h2"
{
cpp2::finally_presuccess cpp2_finally_presuccess;
if (cpp2::Default.has_handler() && !(CPP2_UFCS(is_metafunction)(n)) ) { cpp2::Default.report_violation(""); }
cpp2_finally_presuccess.add([&]{if (cpp2::Default.has_handler() && !(is_reachable() == is_reachable_) ) { cpp2::Default.report_violation(""); }} );
cpp2_finally_presuccess.add([&]{if (cpp2::Default.has_handler() && !(is_const_metafunction() == false) ) { cpp2::Default.report_violation(""); }} );

#line 58 "reflect_impl.h2"
#line 58 "reflect.h2"
if (is_reachable_) {
value += reachable_mangle;
}
Expand All @@ -552,17 +552,17 @@ namespace meta {
}
value += std::move(s);
}
#line 66 "reflect_impl.h2"
#line 66 "reflect.h2"
auto dll_symbol::operator=(std::string_view s) -> dll_symbol&
{
value = {};
#line 68 "reflect_impl.h2"
#line 68 "reflect.h2"
if (!(CPP2_UFCS(starts_with)(s, constant_prefix))) {
value += constant_prefix;
}
value += std::move(s);
return *this;
#line 72 "reflect_impl.h2"
#line 72 "reflect.h2"
}

[[nodiscard]] auto dll_symbol::c_str() const& -> char const* { return CPP2_UFCS(c_str)(value); }
Expand Down Expand Up @@ -598,15 +598,15 @@ dll_symbol::dll_symbol(dll_symbol&& that) noexcept
auto dll_symbol::operator=(dll_symbol&& that) noexcept -> dll_symbol& {
value = std::move(that).value;
return *this;}
#line 96 "reflect_impl.h2"
#line 96 "reflect.h2"
[[nodiscard]] auto symbols_accessor(cpp2::in<std::string_view> lib_path) -> dll_symbol {

return dll_symbol("get_symbol_names_" + cpp2::to_string(to_lower_and_collapsed_underbar(lib_path, true, true))); }

namespace this_execution
{

#line 105 "reflect_impl.h2"
#line 105 "reflect.h2"
[[nodiscard]] auto symbols_accessor() -> dll_symbol

{
Expand All @@ -620,22 +620,22 @@ namespace this_execution

}

#line 131 "reflect_impl.h2"
#line 131 "reflect.h2"
template <typename T> expected<T>::expected(T const& v) { set_value(v); }
#line 131 "reflect_impl.h2"
#line 131 "reflect.h2"
template <typename T> auto expected<T>::operator=(T const& v) -> expected& {
_storage = {};
_discriminator = -1; set_value(v);
return *this; }
#line 132 "reflect_impl.h2"
#line 132 "reflect.h2"
template <typename T> expected<T>::expected(cpp2::in<diagnostic> u) { set_error(u); }
#line 132 "reflect_impl.h2"
#line 132 "reflect.h2"
template <typename T> auto expected<T>::operator=(cpp2::in<diagnostic> u) -> expected& {
_storage = {};
_discriminator = -1; set_error(u);
return *this; }

#line 134 "reflect_impl.h2"
#line 134 "reflect.h2"
template <typename T> template<typename F> [[nodiscard]] auto expected<T>::and_then(F const& f) && -> std::remove_cvref_t<std::invoke_result_t<F,T>>{
if (is_value()) {
return f(value());
Expand Down Expand Up @@ -695,17 +695,17 @@ template <typename T> expected<T>::expected(expected const& that)
if (CPP2_UFCS(is_error)(std::move(that))) {set_error(CPP2_UFCS(error)(std::move(that)));}
return *this;
}
#line 144 "reflect_impl.h2"
#line 144 "reflect.h2"
}

}

#line 402 "reflect_impl.h2"
#line 402 "reflect.h2"
namespace cpp2 {

namespace meta {

#line 428 "reflect_impl.h2"
#line 428 "reflect.h2"
[[nodiscard]] auto compiler_services_data::make(
std::vector<error_entry>* errors_,
std::deque<token>* generated_tokens_,
Expand All @@ -719,7 +719,7 @@ namespace meta {
cpp2::parser(*cpp2::assert_not_null(errors_), source_has_source_interface) };
}

#line 447 "reflect_impl.h2"
#line 447 "reflect.h2"
[[nodiscard]] auto apply_metafunctions(
declaration_node& n,
type_declaration& rtype,
Expand Down Expand Up @@ -808,7 +808,7 @@ namespace meta {
{
auto const& load = load_metafunction(name, lookup);

#line 533 "reflect_impl.h2"
#line 533 "reflect.h2"
if (CPP2_UFCS(is_value)(load)) {
CPP2_UFCS(value)(load)(rtype);
}else {
Expand All @@ -822,7 +822,7 @@ auto const& load = load_metafunction(name, lookup);
return false;
}
}
#line 545 "reflect_impl.h2"
#line 545 "reflect.h2"
}}}}}}}}}}}}}}}}

if ((
Expand All @@ -838,7 +838,7 @@ auto const& load = load_metafunction(name, lookup);
return true;
}

#line 561 "reflect_impl.h2"
#line 561 "reflect.h2"
[[nodiscard]] auto apply_metafunctions(
declaration_node& n,
function_declaration& rfunction,
Expand Down Expand Up @@ -904,7 +904,7 @@ auto const& load = load_metafunction(name, lookup);
return true;
}

#line 627 "reflect_impl.h2"
#line 627 "reflect.h2"
}

}
Expand Down
File renamed without changes.

0 comments on commit 1817e9c

Please sign in to comment.