Merge 9d1dde408c90a7dbddcd98e06485b8fc5a7ae7a4 into f635b51e3f8e95868210edfc66fdbd8e475710f5

This commit is contained in:
Jörn Teuber 2026-09-23 09:31:01 +02:00 committed by GitHub
commit 33769cf0b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 7 deletions

View File

@ -17,6 +17,7 @@
#include <memory>
#include <set>
#include <stdexcept>
#include <exception>
#include <string>
#include <string_view>
#include <thread>

View File

@ -32,12 +32,12 @@ namespace chaiscript {
/// Used internally for handling a return value from a Proxy_Function call
template<typename Ret>
struct Handle_Return {
template<typename T, typename = typename std::enable_if_t<std::is_trivial_v<typename std::decay_t<T>>>>
template<typename T, typename = typename std::enable_if_t<std::is_trivially_copyable_v<typename std::decay_t<T>> && std::is_trivially_default_constructible_v<typename std::decay_t<T>>>>
static Boxed_Value handle(T r) {
return Boxed_Value(std::move(r), true);
}
template<typename T, typename = typename std::enable_if_t<!(std::is_trivial_v<typename std::decay_t<T>>)>>
template<typename T, typename = typename std::enable_if_t<!(std::is_trivially_copyable_v<typename std::decay_t<T>> && std::is_trivially_default_constructible_v<typename std::decay_t<T>>)>>
static Boxed_Value handle(T &&r) {
return Boxed_Value(std::make_shared<T>(std::forward<T>(r)), true);
}

View File

@ -410,7 +410,7 @@ namespace chaiscript {
public:
Dynamic_Proxy_Function_Impl(Callable t_f,
int t_arity = -1,
std::shared_ptr<AST_Node> t_parsenode = AST_NodePtr(),
std::shared_ptr<AST_Node> t_parsenode = nullptr,
Param_Types t_param_types = Param_Types(),
Proxy_Function t_guard = Proxy_Function())
: Dynamic_Proxy_Function(t_arity, std::move(t_parsenode), std::move(t_param_types), std::move(t_guard))

View File

@ -349,14 +349,14 @@ namespace chaiscript {
ss << what();
if (!call_stack.empty()) {
ss << "during evaluation at (" << fname(call_stack[0]) << " " << startpos(call_stack[0]) << ")\n";
ss << "during evaluation at (" << fname(call_stack.at(0)) << " " << startpos(call_stack.at(0)) << ")\n";
ss << '\n'
<< detail << '\n';
ss << " " << fname(call_stack[0]) << " (" << startpos(call_stack[0]) << ") '" << pretty(call_stack[0]) << "'";
ss << " " << fname(call_stack.at(0)) << " (" << startpos(call_stack.at(0)) << ") '" << pretty(call_stack.at(0)) << "'";
for (size_t j = 1; j < call_stack.size(); ++j) {
if (id(call_stack[j]) != chaiscript::AST_Node_Type::Block && id(call_stack[j]) != chaiscript::AST_Node_Type::File) {
if (id(call_stack.at(j)) != chaiscript::AST_Node_Type::Block && id(call_stack.at(j)) != chaiscript::AST_Node_Type::File) {
ss << '\n';
ss << " from " << fname(call_stack[j]) << " (" << startpos(call_stack[j]) << ") '" << pretty(call_stack[j]) << "'";
ss << " from " << fname(call_stack.at(j)) << " (" << startpos(call_stack.at(j)) << ") '" << pretty(call_stack.at(j)) << "'";
}
}
}