A Hugo incarnation of the blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

type_env.cpp 375B

12345678910111213141516
  1. #include "type_env.hpp"
  2. type_ptr type_env::lookup(const std::string& name) const {
  3. auto it = names.find(name);
  4. if(it != names.end()) return it->second;
  5. if(parent) return parent->lookup(name);
  6. return nullptr;
  7. }
  8. void type_env::bind(const std::string& name, type_ptr t) {
  9. names[name] = t;
  10. }
  11. type_env type_env::scope() const {
  12. return type_env(this);
  13. }