mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-11-09 23:00:06 +08:00
Merge 9d1dde408c90a7dbddcd98e06485b8fc5a7ae7a4 into f635b51e3f8e95868210edfc66fdbd8e475710f5
This commit is contained in:
commit
33769cf0b1
@ -17,6 +17,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|||||||
@ -32,12 +32,12 @@ namespace chaiscript {
|
|||||||
/// Used internally for handling a return value from a Proxy_Function call
|
/// Used internally for handling a return value from a Proxy_Function call
|
||||||
template<typename Ret>
|
template<typename Ret>
|
||||||
struct Handle_Return {
|
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) {
|
static Boxed_Value handle(T r) {
|
||||||
return Boxed_Value(std::move(r), true);
|
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) {
|
static Boxed_Value handle(T &&r) {
|
||||||
return Boxed_Value(std::make_shared<T>(std::forward<T>(r)), true);
|
return Boxed_Value(std::make_shared<T>(std::forward<T>(r)), true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -410,7 +410,7 @@ namespace chaiscript {
|
|||||||
public:
|
public:
|
||||||
Dynamic_Proxy_Function_Impl(Callable t_f,
|
Dynamic_Proxy_Function_Impl(Callable t_f,
|
||||||
int t_arity = -1,
|
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(),
|
Param_Types t_param_types = Param_Types(),
|
||||||
Proxy_Function t_guard = Proxy_Function())
|
Proxy_Function t_guard = Proxy_Function())
|
||||||
: Dynamic_Proxy_Function(t_arity, std::move(t_parsenode), std::move(t_param_types), std::move(t_guard))
|
: Dynamic_Proxy_Function(t_arity, std::move(t_parsenode), std::move(t_param_types), std::move(t_guard))
|
||||||
|
|||||||
@ -349,14 +349,14 @@ namespace chaiscript {
|
|||||||
|
|
||||||
ss << what();
|
ss << what();
|
||||||
if (!call_stack.empty()) {
|
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'
|
ss << '\n'
|
||||||
<< detail << '\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) {
|
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 << '\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)) << "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user