StrictModules/Objects/module.cpp (20 lines of code) (raw):
// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
#include "StrictModules/Objects/module.h"
namespace strictmod::objects {
StrictModuleObject::StrictModuleObject(
std::shared_ptr<StrictType> type,
std::string name,
std::shared_ptr<DictType> dict)
: StrictInstance(type, nullptr, std::move(dict)), name_(std::move(name)) {}
std::string StrictModuleObject::getDisplayName() const {
return "<strict module " + name_ + ">";
}
std::shared_ptr<StrictModuleObject> StrictModuleObject::makeStrictModule(
std::shared_ptr<StrictType> type,
std::string name,
std::shared_ptr<DictType> dict) {
auto mod = std::make_shared<StrictModuleObject>(
std::move(type), std::move(name), std::move(dict));
mod->setCreator(mod);
return mod;
}
} // namespace strictmod::objects