diff --git a/include/chaiscript/language/chaiscript_optimizer.hpp b/include/chaiscript/language/chaiscript_optimizer.hpp index e8710596..125782b7 100644 --- a/include/chaiscript/language/chaiscript_optimizer.hpp +++ b/include/chaiscript/language/chaiscript_optimizer.hpp @@ -67,7 +67,7 @@ namespace chaiscript { template auto optimize(const eval::AST_Node_Impl_Ptr &p) { - if (p->identifier == AST_Node_Type::Def + if ( (p->identifier == AST_Node_Type::Def || p->identifier == AST_Node_Type::Lambda) && !p->children.empty()) { auto &last_child = p->children.back(); diff --git a/releasenotes.md b/releasenotes.md index e02bea66..36220309 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -2,7 +2,7 @@ Notes: ======= Current Version: 6.0.0 -### Changes since 5.8.5 +### Changes since 5.8.6 *6.0.0 is a massive rework compared to 5.x. It now requires a C++14 enabled compiler* @@ -39,6 +39,9 @@ Current Version: 6.0.0 * File location tracking has been rewritten; this currently means error location reporting is not as good as it was * Tracing capability needs to be tested and vetted +### Changes since 5.8.5 +* Optimize away `return` statements in lambdas also + ### Changes since 5.8.4 * Fix order of operations for prefix operators * Make sure atomics are initialized properly