From ab59ed159a87f724c8ae4d2005868337da619662 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 5 Aug 2020 22:48:01 +0800 Subject: fix case for extending class without name. --- spec/inputs/class.moon | 3 +++ src/MoonP/moon_compiler.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/inputs/class.moon b/spec/inputs/class.moon index 533694e..ca8b58c 100644 --- a/spec/inputs/class.moon +++ b/spec/inputs/class.moon @@ -226,4 +226,7 @@ do test = Test! test\test! +class extends lapis.Application + "/": => json: { status: true } + nil diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp index 1d9161b..271bc06 100644 --- a/src/MoonP/moon_compiler.cpp +++ b/src/MoonP/moon_compiler.cpp @@ -49,7 +49,7 @@ inline std::string s(std::string_view sv) { } const std::string_view version() { - return "0.4.5"sv; + return "0.4.6"sv; } // name of table stored in lua registry @@ -4117,7 +4117,7 @@ private: if (!className.empty()) { _buf << ","sv << nll(classDecl) << indent(1) << "__name = "sv << className << (extend ? s(","sv) : Empty) << nll(classDecl); } else { - _buf << nll(classDecl); + _buf << (extend ? s(","sv) : Empty) << nll(classDecl); } if (extend) { _buf << indent(1) << "__parent = "sv << parentVar << nll(classDecl); -- cgit v1.2.3-55-g6feb