diff options
author | Li Jin <dragon-fly@qq.com> | 2021-04-28 11:24:19 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-04-28 11:24:19 +0800 |
commit | cf7574a713b3dcc0b1c103ee309919d3f5c1bbd3 (patch) | |
tree | 1128db4911a4ee94fb43de35a86613a67ccc8f40 | |
parent | 4713aeb776489b0dfcf965951a5b8ebbd8fa9581 (diff) | |
download | yuescript-cf7574a713b3dcc0b1c103ee309919d3f5c1bbd3.tar.gz yuescript-cf7574a713b3dcc0b1c103ee309919d3f5c1bbd3.tar.bz2 yuescript-cf7574a713b3dcc0b1c103ee309919d3f5c1bbd3.zip |
make const check work with class declaration.
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index fcfd15a..a8d8053 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -4778,8 +4778,11 @@ private: | |||
4778 | _buf << indent(1) << parentVar << ".__inherited("sv << parentVar << ", "sv << classVar << ")"sv << nll(classDecl); | 4778 | _buf << indent(1) << parentVar << ".__inherited("sv << parentVar << ", "sv << classVar << ")"sv << nll(classDecl); |
4779 | _buf << indent() << "end"sv << nll(classDecl); | 4779 | _buf << indent() << "end"sv << nll(classDecl); |
4780 | } | 4780 | } |
4781 | if (!assignItem.empty()) { | 4781 | if (!assignItem.empty()) { |
4782 | _buf << indent() << assignItem << " = "sv << classVar << nll(classDecl); | 4782 | auto assignment = toAst<ExpListAssign_t>(assignItem + s(" = "sv) + classVar, classDecl); |
4783 | str_list temp; | ||
4784 | transformAssignment(assignment, temp); | ||
4785 | _buf << indent() << temp.back() << nll(classDecl); | ||
4783 | } | 4786 | } |
4784 | switch (usage) { | 4787 | switch (usage) { |
4785 | case ExpUsage::Return: { | 4788 | case ExpUsage::Return: { |
@@ -5369,7 +5372,7 @@ private: | |||
5369 | kv.push_back(valVar); | 5372 | kv.push_back(valVar); |
5370 | } | 5373 | } |
5371 | _buf << indent(int(temp.size()) - 1) << tbl << "["sv << kv.front() << "] = "sv << kv.back() << nll(comp); | 5374 | _buf << indent(int(temp.size()) - 1) << tbl << "["sv << kv.front() << "] = "sv << kv.back() << nll(comp); |
5372 | for (int ind = int(temp.size()) - 2; ind > -1 ; --ind) { | 5375 | for (int ind = int(temp.size()) - 2; ind > -1; --ind) { |
5373 | _buf << indent(ind) << "end"sv << nll(comp); | 5376 | _buf << indent(ind) << "end"sv << nll(comp); |
5374 | } | 5377 | } |
5375 | popScope(); | 5378 | popScope(); |