From 83c6df11f008d7e758736997c23605647543bd30 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sat, 16 Apr 2016 14:30:12 -0600 Subject: [PATCH] Fix global reference assignment --- include/chaiscript/language/chaiscript_eval.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 8ba24e5..eafa01c 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -295,8 +295,13 @@ namespace chaiscript try { if (lhs.is_undef()) { - if (!this->children.empty() - && this->children[0]->identifier == AST_Node_Type::Reference) + if ((!this->children.empty() + && ((this->children[0]->identifier == AST_Node_Type::Reference) + || (!this->children[0]->children.empty() + && this->children[0]->children[0]->identifier == AST_Node_Type::Reference) + ) + ) + ) { /// \todo This does not handle the case of an unassigned reference variable /// being assigned outside of its declaration