Add a todo for another assertion
This commit is contained in:
parent
36b95fe1e5
commit
6f218d8cab
|
@ -52,6 +52,7 @@ bool SereneContext::setCurrentNS(llvm::StringRef ns_name) {
|
|||
};
|
||||
|
||||
std::shared_ptr<Namespace> SereneContext::getCurrentNS() {
|
||||
// TODO: replace the assertion with a runtime check
|
||||
assert(!this->current_ns.empty() && "Current namespace is not set");
|
||||
|
||||
if (namespaces.count(this->current_ns)) {
|
||||
|
|
|
@ -65,18 +65,6 @@ mlir::LogicalResult Namespace::setTree(exprs::Ast &t) {
|
|||
return mlir::success();
|
||||
}
|
||||
|
||||
std::shared_ptr<Namespace>
|
||||
makeNamespace(SereneContext &ctx, llvm::StringRef name,
|
||||
llvm::Optional<llvm::StringRef> filename, bool setCurrent) {
|
||||
auto nsPtr = std::make_shared<Namespace>(ctx, name, filename);
|
||||
ctx.insertNS(nsPtr);
|
||||
if (setCurrent) {
|
||||
if (!ctx.setCurrentNS(nsPtr->name)) {
|
||||
throw std::runtime_error("Couldn't set the current NS");
|
||||
}
|
||||
}
|
||||
return nsPtr;
|
||||
};
|
||||
|
||||
uint Namespace::nextFnCounter() { return fn_counter++; };
|
||||
|
||||
|
@ -136,4 +124,16 @@ MaybeModule Namespace::compileToLLVM() {
|
|||
|
||||
Namespace::~Namespace(){};
|
||||
|
||||
std::shared_ptr<Namespace>
|
||||
makeNamespace(SereneContext &ctx, llvm::StringRef name,
|
||||
llvm::Optional<llvm::StringRef> filename, bool setCurrent) {
|
||||
auto nsPtr = std::make_shared<Namespace>(ctx, name, filename);
|
||||
ctx.insertNS(nsPtr);
|
||||
if (setCurrent) {
|
||||
if (!ctx.setCurrentNS(nsPtr->name)) {
|
||||
throw std::runtime_error("Couldn't set the current NS");
|
||||
}
|
||||
}
|
||||
return nsPtr;
|
||||
};
|
||||
} // namespace serene
|
||||
|
|
Loading…
Reference in New Issue