From 9af15048c75e845d9f6f647a3ebe2f538fac995c Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 6 Apr 2022 18:03:49 +0800 Subject: allow doing mixin with a class and a table. --- src/yuescript/yue_compiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 3e9c048..3c2f809 100755 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -5418,7 +5418,7 @@ private: auto val = getUnusedName("_val_"sv); auto mixins = _parser.toString(classDecl->mixes); _buf << "for "sv << mixin << " in *{"sv << mixins << "}\n"sv; - _buf << "\tfor "sv << key << ',' << val << " in pairs "sv << mixin << ".__base\n"sv; + _buf << "\tfor "sv << key << ',' << val << " in pairs "sv << mixin << ".__class and "sv << mixin << ".__base or "sv << mixin << '\n'; _buf << "\t\t"sv << baseVar << '[' << key << "]="sv << val << " if "sv << baseVar << '[' << key << "]==nil"sv; transformBlock(toAst(clearBuf(), x), temp, ExpUsage::Common); } -- cgit v1.2.3-55-g6feb