Merge branch 'develop' of github.com:ChaiScript/ChaiScript into develop

This commit is contained in:
Jason Turner 2016-12-06 13:43:53 -07:00
commit a8e70a4cfe
5 changed files with 42 additions and 4 deletions

View File

@ -251,8 +251,9 @@ namespace chaiscript
~Sentinel() ~Sentinel()
{ {
// save new pointer data // save new pointer data
m_data.get().m_data_ptr = m_ptr.get().get(); const auto ptr = m_ptr.get().get();
m_data.get().m_const_data_ptr = m_ptr.get().get(); m_data.get().m_data_ptr = ptr;
m_data.get().m_const_data_ptr = ptr;
} }
Sentinel& operator=(Sentinel&&s) = default; Sentinel& operator=(Sentinel&&s) = default;

View File

@ -53,6 +53,11 @@ namespace chaiscript
static Opers to_operator(const std::string &t_str, bool t_is_unary = false) static Opers to_operator(const std::string &t_str, bool t_is_unary = false)
{ {
#ifdef CHAISCRIPT_MSVC
#pragma warning(push)
#pragma warning(disable : 4307)
#endif
const auto op_hash = utility::fnv1a_32(t_str.c_str()); const auto op_hash = utility::fnv1a_32(t_str.c_str());
switch (op_hash) { switch (op_hash) {
case utility::fnv1a_32("=="): { return Opers::equals; } case utility::fnv1a_32("=="): { return Opers::equals; }
@ -86,6 +91,10 @@ namespace chaiscript
case utility::fnv1a_32("*"): { return Opers::product; } case utility::fnv1a_32("*"): { return Opers::product; }
default: { return Opers::invalid; } default: { return Opers::invalid; }
} }
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif
} }
}; };

View File

@ -433,13 +433,13 @@ namespace chaiscript
try { try {
if (lhs.is_undef()) { if (lhs.is_undef()) {
if ((!this->children.empty() if (!this->children.empty()
&& ((this->children[0]->identifier == AST_Node_Type::Reference) && ((this->children[0]->identifier == AST_Node_Type::Reference)
|| (!this->children[0]->children.empty() || (!this->children[0]->children.empty()
&& this->children[0]->children[0]->identifier == AST_Node_Type::Reference) && this->children[0]->children[0]->identifier == AST_Node_Type::Reference)
) )
)
) )
{ {
/// \todo This does not handle the case of an unassigned reference variable /// \todo This does not handle the case of an unassigned reference variable
/// being assigned outside of its declaration /// being assigned outside of its declaration

View File

@ -884,6 +884,11 @@ namespace chaiscript
validate_object_name(text); validate_object_name(text);
} }
#ifdef CHAISCRIPT_MSVC
#pragma warning(push)
#pragma warning(disable : 4307)
#endif
switch (text_hash) { switch (text_hash) {
case utility::fnv1a_32("true"): { case utility::fnv1a_32("true"): {
m_match_stack.push_back(make_node<eval::Constant_AST_Node<Tracer>>(std::move(text), start.line, start.col, const_var(true))); m_match_stack.push_back(make_node<eval::Constant_AST_Node<Tracer>>(std::move(text), start.line, start.col, const_var(true)));
@ -948,6 +953,11 @@ namespace chaiscript
} break; } break;
} }
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif
return true; return true;
} else { } else {
return false; return false;

View File

@ -7,16 +7,34 @@
#ifndef CHAISCRIPT_UTILITY_FNV1A_HPP_ #ifndef CHAISCRIPT_UTILITY_FNV1A_HPP_
#define CHAISCRIPT_UTILITY_FNV1A_HPP_ #define CHAISCRIPT_UTILITY_FNV1A_HPP_
#include <cstdint> #include <cstdint>
#include "../chaiscript_defines.hpp"
namespace chaiscript namespace chaiscript
{ {
namespace utility namespace utility
{ {
static constexpr std::uint32_t fnv1a_32(const char *s, std::uint32_t h = 0x811c9dc5) { static constexpr std::uint32_t fnv1a_32(const char *s, std::uint32_t h = 0x811c9dc5) {
#ifdef CHAISCRIPT_MSVC
#pragma warning(push)
#pragma warning(disable : 4307)
#endif
return (*s == 0) ? h : fnv1a_32(s+1, ((h ^ (*s)) * 0x01000193)); return (*s == 0) ? h : fnv1a_32(s+1, ((h ^ (*s)) * 0x01000193));
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif
} }
} }
} }
#endif #endif