chigraph  master
Systems programming language written for beginners in LLVM
ChiModule.cpp
Go to the documentation of this file.
1 
3 #include "chi/ChiModule.hpp"
4 #include "chi/Context.hpp"
5 #include "chi/Support/Result.hpp"
6 
7 namespace chi {
8 ChiModule::ChiModule(Context& contextArg, boost::filesystem::path moduleFullName)
9  : mFullName{std::move(moduleFullName)}, mContext{&contextArg} {
10  mName = mFullName.filename().string();
11 }
12 
13 Result ChiModule::addDependency(boost::filesystem::path newDepFullPath) {
14  Result res = context().loadModule(newDepFullPath);
15 
16  if (res) { mDependencies.emplace(std::move(newDepFullPath)); }
17 
18  return res;
19 }
20 } // namespace chi
Defines the Result class and related functions.
Result loadModule(const boost::filesystem::path &name, ChiModule **toFill=nullptr)
Load a module from disk, also loads dependencies.
Definition: Context.cpp:91
Result addDependency(boost::filesystem::path newDepFullPath)
Add a dependency to the module Loads the module from context() if it isn't already loaded...
Definition: ChiModule.cpp:13
ChiModule(Context &contextArg, boost::filesystem::path moduleFullName)
Default constructor.
Definition: ChiModule.cpp:8
The class that handles the loading, creation, storing, and compilation of modules It also stores a LL...
Definition: Context.hpp:55
Defines the ChiModule class.
The namespace where chigraph lives.
Context & context() const
Get the Context that this module belongs to.
Definition: ChiModule.hpp:68
Defines the Context class and related functions.
The result object, used for identifiying errors with good diagnostics.
Definition: Result.hpp:72