Never access data after moving it!
This commit is contained in:
parent
d77921f1b5
commit
e286b9a9aa
@ -998,7 +998,7 @@ namespace chaiscript
|
|||||||
public:
|
public:
|
||||||
Case_AST_Node(std::string t_ast_node_text, Parse_Location t_loc, std::vector<AST_NodePtr> t_children) :
|
Case_AST_Node(std::string t_ast_node_text, Parse_Location t_loc, std::vector<AST_NodePtr> t_children) :
|
||||||
AST_Node(std::move(t_ast_node_text), AST_Node_Type::Case, std::move(t_loc), std::move(t_children))
|
AST_Node(std::move(t_ast_node_text), AST_Node_Type::Case, std::move(t_loc), std::move(t_children))
|
||||||
{ assert(t_children.size() == 2); }
|
{ assert(children.size() == 2); /* how many children does it have? */ }
|
||||||
|
|
||||||
virtual ~Case_AST_Node() {}
|
virtual ~Case_AST_Node() {}
|
||||||
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) const CHAISCRIPT_OVERRIDE {
|
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) const CHAISCRIPT_OVERRIDE {
|
||||||
@ -1014,7 +1014,7 @@ namespace chaiscript
|
|||||||
public:
|
public:
|
||||||
Default_AST_Node(std::string t_ast_node_text, Parse_Location t_loc, std::vector<AST_NodePtr> t_children) :
|
Default_AST_Node(std::string t_ast_node_text, Parse_Location t_loc, std::vector<AST_NodePtr> t_children) :
|
||||||
AST_Node(std::move(t_ast_node_text), AST_Node_Type::Default, std::move(t_loc), std::move(t_children))
|
AST_Node(std::move(t_ast_node_text), AST_Node_Type::Default, std::move(t_loc), std::move(t_children))
|
||||||
{ assert(t_children.size() == 1); }
|
{ assert(children.size() == 1); }
|
||||||
virtual ~Default_AST_Node() {}
|
virtual ~Default_AST_Node() {}
|
||||||
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) const CHAISCRIPT_OVERRIDE {
|
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss) const CHAISCRIPT_OVERRIDE {
|
||||||
chaiscript::eval::detail::Scope_Push_Pop spp(t_ss);
|
chaiscript::eval::detail::Scope_Push_Pop spp(t_ss);
|
||||||
|
@ -719,7 +719,8 @@ namespace chaiscript
|
|||||||
if (has_more_input() && char_in_alphabet(*m_input_pos, detail::float_alphabet) ) {
|
if (has_more_input() && char_in_alphabet(*m_input_pos, detail::float_alphabet) ) {
|
||||||
if (Hex_()) {
|
if (Hex_()) {
|
||||||
std::string match(start, m_input_pos);
|
std::string match(start, m_input_pos);
|
||||||
m_match_stack.emplace_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, buildInt(std::hex, match)));
|
auto bv = buildInt(std::hex, match);
|
||||||
|
m_match_stack.emplace_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, std::move(bv)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,30 +738,34 @@ namespace chaiscript
|
|||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Boxed_Value i;
|
Boxed_Value i = [&](){
|
||||||
if (match.length() <= sizeof(int) * 8)
|
if (match.length() <= sizeof(int) * 8)
|
||||||
{
|
{
|
||||||
i = const_var(static_cast<int>(temp_int));
|
return const_var(static_cast<int>(temp_int));
|
||||||
} else {
|
} else {
|
||||||
i = const_var(temp_int);
|
return const_var(temp_int);
|
||||||
}
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
m_match_stack.push_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, std::move(i)));
|
m_match_stack.push_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, std::move(i)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Float_()) {
|
if (Float_()) {
|
||||||
std::string match(start, m_input_pos);
|
std::string match(start, m_input_pos);
|
||||||
m_match_stack.push_back(make_node<eval::Float_AST_Node>(std::move(match), prev_line, prev_col, buildFloat(match)));
|
auto bv = buildFloat(match);
|
||||||
|
m_match_stack.push_back(make_node<eval::Float_AST_Node>(std::move(match), prev_line, prev_col, std::move(bv)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IntSuffix_();
|
IntSuffix_();
|
||||||
std::string match(start, m_input_pos);
|
std::string match(start, m_input_pos);
|
||||||
if (!match.empty() && (match[0] == '0')) {
|
if (!match.empty() && (match[0] == '0')) {
|
||||||
m_match_stack.push_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, buildInt(std::oct, match)));
|
auto bv = buildInt(std::oct, match);
|
||||||
|
m_match_stack.push_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, std::move(bv)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_match_stack.push_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, buildInt(std::dec, match)));
|
auto bv = buildInt(std::dec, match);
|
||||||
|
m_match_stack.push_back(make_node<eval::Int_AST_Node>(std::move(match), prev_line, prev_col, std::move(bv)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user