f97c260b0b
The environment object is a "smart-pointer". Before this commit, the use of "const &" for environment objects was broken. For example, suppose we have a function f that should not modify the input environment. Before this commit, its signature would be void f(environment const & env) This is broken, f's implementation can easilty convert it to a read-write pointer by using the copy constructor. environment rw_env(env); Now, f can use rw_env to update env. To fix this issue, we now have ro_environment. It is a shared *const* pointer. We can convert an environment into a ro_environment, but not the other way around. ro_environment can also be seen as a form of documentation. For example, now it is clear that type_inferer is not updating the environment, since its constructor takes a ro_environment. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com> |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
coercion.h | ||
frontend.cpp | ||
frontend.h | ||
frontend_elaborator.cpp | ||
frontend_elaborator.h | ||
notation.cpp | ||
notation.h | ||
operator_info.cpp | ||
operator_info.h | ||
parser.cpp | ||
parser.h | ||
pp.cpp | ||
pp.h | ||
register_module.cpp | ||
register_module.h | ||
scanner.cpp | ||
scanner.h |