diff options
Diffstat (limited to '')
| -rw-r--r-- | spec/inputs/funcs.mp | 1 | ||||
| -rw-r--r-- | spec/inputs/macro.mp | 2 | ||||
| -rw-r--r-- | src/MoonP/moon_compiler.cpp | 11 |
3 files changed, 9 insertions, 5 deletions
diff --git a/spec/inputs/funcs.mp b/spec/inputs/funcs.mp index 4176e33..0e45ff1 100644 --- a/spec/inputs/funcs.mp +++ b/spec/inputs/funcs.mp | |||
| @@ -46,6 +46,7 @@ _ = (x = if something then yeah else no) -> | |||
| 46 | something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") -> | 46 | something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") -> |
| 47 | print hello | 47 | print hello |
| 48 | 48 | ||
| 49 | _ = () => | ||
| 49 | _ = (x, y) => | 50 | _ = (x, y) => |
| 50 | _ = (@x, @y) => | 51 | _ = (@x, @y) => |
| 51 | _ = (x=1) => | 52 | _ = (x=1) => |
diff --git a/spec/inputs/macro.mp b/spec/inputs/macro.mp index fafa522..be88a3f 100644 --- a/spec/inputs/macro.mp +++ b/spec/inputs/macro.mp | |||
| @@ -110,7 +110,7 @@ do | |||
| 110 | a += $get_inner_hygienic! | 110 | a += $get_inner_hygienic! |
| 111 | print a | 111 | print a |
| 112 | 112 | ||
| 113 | macro lua lua = (codes)-> "#{codes}" | 113 | macro lua lua = (codes)-> codes |
| 114 | 114 | ||
| 115 | x = 0 | 115 | x = 0 |
| 116 | 116 | ||
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp index d49cf14..e8649ae 100644 --- a/src/MoonP/moon_compiler.cpp +++ b/src/MoonP/moon_compiler.cpp | |||
| @@ -53,7 +53,7 @@ inline std::string s(std::string_view sv) { | |||
| 53 | return std::string(sv); | 53 | return std::string(sv); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | const std::string_view version = "0.4.22"sv; | 56 | const std::string_view version = "0.4.23"sv; |
| 57 | const std::string_view extension = "mp"sv; | 57 | const std::string_view extension = "mp"sv; |
| 58 | 58 | ||
| 59 | class MoonCompilerImpl { | 59 | class MoonCompilerImpl { |
| @@ -1877,9 +1877,12 @@ private: | |||
| 1877 | auto& args = *it; | 1877 | auto& args = *it; |
| 1878 | auto& initArgs = *(++it); | 1878 | auto& initArgs = *(++it); |
| 1879 | auto& bodyCodes = *(++it); | 1879 | auto& bodyCodes = *(++it); |
| 1880 | _buf << "function("sv << | 1880 | _buf << "function("sv; |
| 1881 | (isFatArrow ? s("self, "sv) : Empty) << | 1881 | if (isFatArrow) { |
| 1882 | args << ')'; | 1882 | _buf << "self"sv; |
| 1883 | if (!args.empty()) _buf << ", "sv; | ||
| 1884 | } | ||
| 1885 | _buf << args << ')'; | ||
| 1883 | if (!initArgs.empty() || !bodyCodes.empty()) { | 1886 | if (!initArgs.empty() || !bodyCodes.empty()) { |
| 1884 | _buf << nlr(argsDef) << initArgs << bodyCodes; | 1887 | _buf << nlr(argsDef) << initArgs << bodyCodes; |
| 1885 | popScope(); | 1888 | popScope(); |
