@@ -31,7 +31,9 @@ using namespace std::chrono_literals;
31
31
#include " linenoise.hpp"
32
32
33
33
#if not(defined YUE_NO_MACRO && defined YUE_COMPILER_ONLY)
34
- #define _DEFER (code, line ) std::shared_ptr<void > _defer_##line(nullptr , [&](auto ) { code; })
34
+ #define _DEFER (code, line ) std::shared_ptr<void > _defer_##line(nullptr , [&](auto ) { \
35
+ code; \
36
+ })
35
37
#define DEFER (code ) _DEFER(code, __LINE__)
36
38
extern " C" {
37
39
#include " lauxlib.h"
@@ -292,6 +294,7 @@ int main(int narg, const char** args) {
292
294
" -b Dump compile time (doesn't write output)\n "
293
295
" -g Dump global variables used in NAME LINE COLUMN\n "
294
296
" -l Write line numbers from source codes\n "
297
+ " -j Disable implicit return at end of file\n "
295
298
" -c Reserve comments before statement from source codes\n "
296
299
#ifndef YUE_NO_WATCHER
297
300
" -w path Watch changes and compile every file under directory\n "
@@ -597,6 +600,8 @@ int main(int narg, const char** args) {
597
600
config.reserveLineNumber = true ;
598
601
} else if (arg == " -c" sv) {
599
602
config.reserveComment = true ;
603
+ } else if (arg == " -j" sv) {
604
+ config.implicitReturnRoot = false ;
600
605
} else if (arg == " -p" sv) {
601
606
writeToFile = false ;
602
607
} else if (arg == " -g" sv) {
@@ -632,7 +637,7 @@ int main(int narg, const char** args) {
632
637
#else
633
638
std::cout << " Error: -w is not supported\n " sv;
634
639
return 1 ;
635
- #endif // YUE_NO_WATCHER
640
+ #endif // YUE_NO_WATCHER
636
641
} else if (arg.size () > 2 && arg.substr (0 , 2 ) == " --" sv && arg.substr (2 , 1 ) != " -" sv) {
637
642
auto argStr = arg.substr (2 );
638
643
yue::Utils::trim (argStr);
@@ -698,7 +703,7 @@ int main(int narg, const char** args) {
698
703
#ifndef YUE_COMPILER_ONLY
699
704
return compileFile (fs::absolute (file.first ), config, fullWorkPath, fullTargetPath, minify, rewrite);
700
705
#else
701
- return compileFile (fs::absolute (file.first ), config, fullWorkPath, fullTargetPath);
706
+ return compileFile (fs::absolute (file.first ), config, fullWorkPath, fullTargetPath);
702
707
#endif // YUE_COMPILER_ONLY
703
708
});
704
709
results.push_back (std::move (task));
0 commit comments