diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-09-11 14:55:22 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-09-11 14:55:22 +0800 |
| commit | dfd4e3b2b2abc0137d26ed3df303a398741bb6a0 (patch) | |
| tree | 59a1690ad02d56d3f303f6ac1dea9e5d6cdc8f20 /src/MoonP/moon_compiler.cpp | |
| parent | eba73a696c65932534fd5aefbe2ca4c7260c0fb6 (diff) | |
| download | yuescript-dfd4e3b2b2abc0137d26ed3df303a398741bb6a0.tar.gz yuescript-dfd4e3b2b2abc0137d26ed3df303a398741bb6a0.tar.bz2 yuescript-dfd4e3b2b2abc0137d26ed3df303a398741bb6a0.zip | |
add implicit objects support while writing tables.
Diffstat (limited to 'src/MoonP/moon_compiler.cpp')
| -rw-r--r-- | src/MoonP/moon_compiler.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp index 2f16fff..406b412 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) { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | const std::string_view version() { | 51 | const std::string_view version() { |
| 52 | return "0.4.10"sv; | 52 | return "0.4.12"sv; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | // name of table stored in lua registry | 55 | // name of table stored in lua registry |
| @@ -4608,6 +4608,7 @@ private: | |||
| 4608 | case id<Exp_t>(): transformExp(static_cast<Exp_t*>(pair), temp, ExpUsage::Closure); break; | 4608 | case id<Exp_t>(): transformExp(static_cast<Exp_t*>(pair), temp, ExpUsage::Closure); break; |
| 4609 | case id<variable_pair_t>(): transform_variable_pair(static_cast<variable_pair_t*>(pair), temp); break; | 4609 | case id<variable_pair_t>(): transform_variable_pair(static_cast<variable_pair_t*>(pair), temp); break; |
| 4610 | case id<normal_pair_t>(): transform_normal_pair(static_cast<normal_pair_t*>(pair), temp); break; | 4610 | case id<normal_pair_t>(): transform_normal_pair(static_cast<normal_pair_t*>(pair), temp); break; |
| 4611 | case id<TableBlockIndent_t>(): transformTableBlockIndent(static_cast<TableBlockIndent_t*>(pair), temp); break; | ||
| 4611 | default: assert(false); break; | 4612 | default: assert(false); break; |
| 4612 | } | 4613 | } |
| 4613 | temp.back() = indent() + temp.back() + (pair == pairs.back() ? Empty : s(","sv)) + nll(pair); | 4614 | temp.back() = indent() + temp.back() + (pair == pairs.back() ? Empty : s(","sv)) + nll(pair); |
| @@ -4728,6 +4729,10 @@ private: | |||
| 4728 | addToScope(varName); | 4729 | addToScope(varName); |
| 4729 | } | 4730 | } |
| 4730 | 4731 | ||
| 4732 | void transformTableBlockIndent(TableBlockIndent_t* table, str_list& out) { | ||
| 4733 | transformTable(table, table->values.objects(), out); | ||
| 4734 | } | ||
| 4735 | |||
| 4731 | void transformTableBlock(TableBlock_t* table, str_list& out) { | 4736 | void transformTableBlock(TableBlock_t* table, str_list& out) { |
| 4732 | transformTable(table, table->values.objects(), out); | 4737 | transformTable(table, table->values.objects(), out); |
| 4733 | } | 4738 | } |
