aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-03-23 14:48:21 +0800
committerLi Jin <dragon-fly@qq.com>2023-03-23 14:48:21 +0800
commit5337b7ed406bfe6c545ae106cedcdd893bd76a99 (patch)
treee08ab1188e23e45945646d85071e6f18e1d5808a
parent545b116545e8e312a299afc482e5705b17b98578 (diff)
downloadyuescript-5337b7ed406bfe6c545ae106cedcdd893bd76a99.tar.gz
yuescript-5337b7ed406bfe6c545ae106cedcdd893bd76a99.tar.bz2
yuescript-5337b7ed406bfe6c545ae106cedcdd893bd76a99.zip
fix yue build.
-rw-r--r--src/yue.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/yue.cpp b/src/yue.cpp
index 0b13688..8edac36 100644
--- a/src/yue.cpp
+++ b/src/yue.cpp
@@ -167,7 +167,7 @@ static std::string compileFile(const fs::path& file, yue::YueConfig conf, const
167 } 167 }
168 } 168 }
169 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf); 169 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf);
170 if (result.error.empty()) { 170 if (!result.error) {
171 std::string targetExtension("lua"sv); 171 std::string targetExtension("lua"sv);
172 if (result.options) { 172 if (result.options) {
173 auto it = result.options->find("target_extension"s); 173 auto it = result.options->find("target_extension"s);
@@ -194,7 +194,7 @@ static std::string compileFile(const fs::path& file, yue::YueConfig conf, const
194 return "Failed to write file: "s + targetFile.string() + '\n'; 194 return "Failed to write file: "s + targetFile.string() + '\n';
195 } 195 }
196 } else { 196 } else {
197 return "Failed to compile: "s + modulePath.string() + '\n' + result.error + '\n'; 197 return "Failed to compile: "s + modulePath.string() + '\n' + result.error.value().displayMessage + '\n';
198 } 198 }
199 } else { 199 } else {
200 return "Failed to read file: "s + srcFile.string() + '\n'; 200 return "Failed to read file: "s + srcFile.string() + '\n';
@@ -441,12 +441,12 @@ int main(int narg, const char** args) {
441 conf.reserveLineNumber = false; 441 conf.reserveLineNumber = false;
442 conf.useSpaceOverTab = true; 442 conf.useSpaceOverTab = true;
443 auto result = yue::YueCompiler{YUE_ARGS}.compile(codes, conf); 443 auto result = yue::YueCompiler{YUE_ARGS}.compile(codes, conf);
444 if (result.error.empty()) { 444 if (!result.error) {
445 std::cout << result.codes; 445 std::cout << result.codes;
446 return 0; 446 return 0;
447 } else { 447 } else {
448 std::ostringstream buf; 448 std::ostringstream buf;
449 std::cout << result.error << '\n'; 449 std::cout << result.error.value().displayMessage << '\n';
450 return 1; 450 return 1;
451 } 451 }
452#ifndef YUE_COMPILER_ONLY 452#ifndef YUE_COMPILER_ONLY
@@ -662,7 +662,7 @@ int main(int narg, const char** args) {
662 if (dumpCompileTime) { 662 if (dumpCompileTime) {
663 conf.profiling = true; 663 conf.profiling = true;
664 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf); 664 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf);
665 if (!result.codes.empty()) { 665 if (!result.error) {
666 std::ostringstream buf; 666 std::ostringstream buf;
667 buf << file.first << " \n"sv; 667 buf << file.first << " \n"sv;
668 buf << "Parse time: "sv << std::setprecision(5) << result.parseTime * 1000 << " ms\n"; 668 buf << "Parse time: "sv << std::setprecision(5) << result.parseTime * 1000 << " ms\n";
@@ -671,13 +671,13 @@ int main(int narg, const char** args) {
671 } else { 671 } else {
672 std::ostringstream buf; 672 std::ostringstream buf;
673 buf << "Failed to compile: "sv << file.first << '\n'; 673 buf << "Failed to compile: "sv << file.first << '\n';
674 buf << result.error << '\n'; 674 buf << result.error.value().displayMessage << '\n';
675 return std::tuple{1, file.first, buf.str()}; 675 return std::tuple{1, file.first, buf.str()};
676 } 676 }
677 } 677 }
678 conf.lintGlobalVariable = lintGlobal; 678 conf.lintGlobalVariable = lintGlobal;
679 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf); 679 auto result = yue::YueCompiler{YUE_ARGS}.compile(s, conf);
680 if (result.error.empty()) { 680 if (!result.error) {
681 if (!writeToFile) { 681 if (!writeToFile) {
682 if (lintGlobal) { 682 if (lintGlobal) {
683 std::ostringstream buf; 683 std::ostringstream buf;
@@ -729,7 +729,7 @@ int main(int narg, const char** args) {
729 } else { 729 } else {
730 std::ostringstream buf; 730 std::ostringstream buf;
731 buf << "Failed to compile: "sv << file.first << '\n'; 731 buf << "Failed to compile: "sv << file.first << '\n';
732 buf << result.error << '\n'; 732 buf << result.error.value().displayMessage << '\n';
733 return std::tuple{1, std::string(), buf.str()}; 733 return std::tuple{1, std::string(), buf.str()};
734 } 734 }
735 } else { 735 } else {