From 513c9a44a08bb1a1aa58a9bed68104b49b352791 Mon Sep 17 00:00:00 2001 From: Username404 Date: Wed, 16 Mar 2022 13:51:36 +0100 Subject: [PATCH] Re-add a variable to hold the current target in main.cpp, and capture it by value in the compile function Signed-off-by: Username404 --- src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4bed4eb..031c72e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,8 +46,9 @@ int main(int argc, char* argv[]) { } else invalid_argument: Yerbacon::fail({"\"", currentArg.data(), "\" is not a valid argument."}); } } - const auto compile = [&target, &newLines](string_view name) -> string { - string transpiledString = Target::forName(target, newLines)->transpileWithTree(parseString(getFileContent(name.data()))); + const auto current_target = Target::forName(target, newLines); + const auto compile = [&target, current_target](string_view name) -> string { + string transpiledString = current_target->transpileWithTree(parseString(getFileContent(name.data()))); name.remove_suffix(6); string outputFile; (outputFile = name).append(target);