diff --git a/Tutorial/Console_Workflow/W05_Compile/Main.cpp b/Tutorial/Console_Workflow/W05_Compile/Main.cpp index f08ee042..33a7e066 100644 --- a/Tutorial/Console_Workflow/W05_Compile/Main.cpp +++ b/Tutorial/Console_Workflow/W05_Compile/Main.cpp @@ -1,6 +1,7 @@ #include #include "../W05_Lib/W05_Lib.h" +using namespace vl::collections; using namespace vl::stream; using namespace vl::parsing; using namespace vl::filesystem; @@ -46,14 +47,17 @@ int wmain(int argc, const wchar_t* argv[]) GetGlobalTypeManager()->Load(); { + // prepare Workflow script code + List codes; + codes.Add(WString(ScriptCode, false)); + // compile code - // this is required because we produce assembly and C++ code at the same time + // WfLexicalScopeManager is required because we produce assembly and C++ code at the same time + List> errors; auto table = WfLoadTable(); WfLexicalScopeManager manager(table); - manager.AddModule(WString(ScriptCode, false)); - CHECK_ERROR(manager.errors.Count() == 0, L"Please check the 'manager.errors' variable."); - manager.Rebuild(true); - CHECK_ERROR(manager.errors.Count() == 0, L"Please check the 'manager.errors' variable."); + auto assembly = Compile(table, &manager, codes, errors); + CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable."); // save the assembly to file {