diff options
Diffstat (limited to 'source/20-codegen-compiler/main.cpp')
-rw-r--r-- | source/20-codegen-compiler/main.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/20-codegen-compiler/main.cpp b/source/20-codegen-compiler/main.cpp index 81b5d23..5350f8e 100644 --- a/source/20-codegen-compiler/main.cpp +++ b/source/20-codegen-compiler/main.cpp @@ -593,7 +593,6 @@ struct ParserState { }; struct ParserOutput { - CodegenModel model; CodegenOutput headerOutput; CodegenOutput sourceOutput; CodegenOutput standaloneSourceOutput; @@ -745,7 +744,7 @@ void ParseInputFileAndGenerate(AppState& as, CodegenLexer& /*lexingState*/ ls, s break; } - po.currentNamespace = po.model.AddNamespace(DeclNamespace{ + po.currentNamespace = as.model->AddNamespace(DeclNamespace{ .container = po.currentNamespace, .name = tokens[idx].text, }); @@ -817,7 +816,7 @@ void ParseInputFileAndGenerate(AppState& as, CodegenLexer& /*lexingState*/ ls, s // TODO support namespace qualified names auto baseClassFullname = Utils::MakeFullName(idenTok.text, po.currentNamespace); - auto baseClassDecl = po.model.FindStruct(baseClassFullname); + auto baseClassDecl = as.model->FindStruct(baseClassFullname); if (baseClassDecl) { // We silently ignore a non-existent base class, because they may reside in a file that we didn't scan structDecl.baseClasses.push_back(baseClassDecl); @@ -844,7 +843,7 @@ void ParseInputFileAndGenerate(AppState& as, CodegenLexer& /*lexingState*/ ls, s { // Get a pointer to the decl inside CodegenInput's storage - auto decl = po.model.AddStruct(std::move(fullname), std::move(structDecl)); + auto decl = as.model->AddStruct(std::move(fullname), std::move(structDecl)); po.currentStruct = decl; po.currentStructBraceDepth = po.currentBraceDepth; } @@ -946,7 +945,7 @@ void ParseInputFileAndGenerate(AppState& as, CodegenLexer& /*lexingState*/ ls, s } { - auto decl = po.model.AddEnum(std::move(fullname), std::move(enumDecl)); + auto decl = as.model->AddEnum(std::move(fullname), std::move(enumDecl)); po.currentEnum = decl; po.currentEnumBraceDepth = po.currentBraceDepth; } @@ -1194,7 +1193,7 @@ void ParseInputFileAndGenerate(AppState& as, CodegenLexer& /*lexingState*/ ls, s Utils::WriteOutputFile(po.standaloneSourceOutput, generatedCppName); as.modelArchive->DeleteDeclsRelatedToFile(filenameStem); - as.modelArchive->Store(po.model); + // as.modelArchive->Store(po.model); } void HandleInputFile(AppState& as, const fs::path& path) { @@ -1360,10 +1359,10 @@ where --output-dir=<path>: the *directory* to write generated contents to. Thi // - follow the file links in database, and propagate parsing to those files in the hierarchy // - pretty much defeats the purpose of using an incremental parser: some classes like GameObject will have links throughout a very large portion of the project code CodegenModel model; - CodegenModelArchive archive(as.databaseFilePath); + CodegenModelArchive modelArchive(as.databaseFilePath); as.model = &model; - as.modelArchive = &archive; + as.modelArchive = &modelArchive; // Positional argument pass for (int i = 1; i < argc; ++i) { @@ -1384,6 +1383,8 @@ where --output-dir=<path>: the *directory* to write generated contents to. Thi } } + modelArchive.Store(model); + return 0; } |