diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-04-24 16:17:44 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-04-24 16:17:44 +0800 |
| commit | feac3c1cba6ca95b911240217f74a494680cd057 (patch) | |
| tree | e85b6648a51c3355181bd1ad86f3a043c5223ee2 /src/MoonP/moon_compiler.cpp | |
| parent | ade971c9b5f5d367de72ab8e65e9c651ce87cc9a (diff) | |
| download | yuescript-feac3c1cba6ca95b911240217f74a494680cd057.tar.gz yuescript-feac3c1cba6ca95b911240217f74a494680cd057.tar.bz2 yuescript-feac3c1cba6ca95b911240217f74a494680cd057.zip | |
fix errors when explicitly declaring global or local variable initialized with table block.
Diffstat (limited to '')
| -rw-r--r-- | src/MoonP/moon_compiler.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp index 80ab5a9..c9d9c78 100644 --- a/src/MoonP/moon_compiler.cpp +++ b/src/MoonP/moon_compiler.cpp | |||
| @@ -43,7 +43,7 @@ inline std::string s(std::string_view sv) { | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | const std::string_view version() { | 45 | const std::string_view version() { |
| 46 | return "0.3.9"sv; | 46 | return "0.3.10"sv; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | // name of table stored in lua registry | 49 | // name of table stored in lua registry |
| @@ -4364,7 +4364,12 @@ private: | |||
| 4364 | auto assignment = x->new_ptr<ExpListAssign_t>(); | 4364 | auto assignment = x->new_ptr<ExpListAssign_t>(); |
| 4365 | assignment->expList.set(expList); | 4365 | assignment->expList.set(expList); |
| 4366 | auto assign = x->new_ptr<Assign_t>(); | 4366 | auto assign = x->new_ptr<Assign_t>(); |
| 4367 | assign->values.dup(values->valueList->exprs); | 4367 | if (auto expListLow = values->valueList.as<ExpListLow_t>()) { |
| 4368 | assign->values.dup(expListLow->exprs); | ||
| 4369 | } else { | ||
| 4370 | auto tableBlock = values->valueList.to<TableBlock_t>(); | ||
| 4371 | assign->values.push_back(tableBlock); | ||
| 4372 | } | ||
| 4368 | assignment->action.set(assign); | 4373 | assignment->action.set(assign); |
| 4369 | transformAssignment(assignment, out); | 4374 | transformAssignment(assignment, out); |
| 4370 | } else { | 4375 | } else { |
| @@ -4993,7 +4998,12 @@ private: | |||
| 4993 | auto assignment = x->new_ptr<ExpListAssign_t>(); | 4998 | auto assignment = x->new_ptr<ExpListAssign_t>(); |
| 4994 | assignment->expList.set(expList); | 4999 | assignment->expList.set(expList); |
| 4995 | auto assign = x->new_ptr<Assign_t>(); | 5000 | auto assign = x->new_ptr<Assign_t>(); |
| 4996 | assign->values.dup(values->valueList->exprs); | 5001 | if (auto expListLow = values->valueList.as<ExpListLow_t>()) { |
| 5002 | assign->values.dup(expListLow->exprs); | ||
| 5003 | } else { | ||
| 5004 | auto tableBlock = values->valueList.to<TableBlock_t>(); | ||
| 5005 | assign->values.push_back(tableBlock); | ||
| 5006 | } | ||
| 4997 | assignment->action.set(assign); | 5007 | assignment->action.set(assign); |
| 4998 | transformAssignment(assignment, temp); | 5008 | transformAssignment(assignment, temp); |
| 4999 | } | 5009 | } |
