Remove support for 'pervious' environments
This commit is contained in:
parent
be6537f9b9
commit
ebc51539ad
2 changed files with 1 additions and 35 deletions
|
@ -138,24 +138,9 @@ namespace bolt {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
/**
|
|
||||||
* Indicates that the typing environment of the current context will not
|
|
||||||
* hold on to any bindings.
|
|
||||||
*
|
|
||||||
* Concretely, bindings that are assigned fall through to the parent
|
|
||||||
* context, where this process is repeated until an environment is found
|
|
||||||
* that is not pervious.
|
|
||||||
*/
|
|
||||||
InferContextFlags_PerviousEnv = 1 << 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
using InferContextFlagsMask = unsigned;
|
using InferContextFlagsMask = unsigned;
|
||||||
|
|
||||||
class InferContext {
|
class InferContext {
|
||||||
|
|
||||||
InferContextFlagsMask Flags = 0;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,18 +158,6 @@ namespace bolt {
|
||||||
Type* ReturnType = nullptr;
|
Type* ReturnType = nullptr;
|
||||||
std::vector<TypeclassSignature> Classes;
|
std::vector<TypeclassSignature> Classes;
|
||||||
|
|
||||||
inline void setIsEnvPervious(bool Enable) noexcept {
|
|
||||||
if (Enable) {
|
|
||||||
Flags |= InferContextFlags_PerviousEnv;
|
|
||||||
} else {
|
|
||||||
Flags &= ~InferContextFlags_PerviousEnv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool isEnvPervious() const noexcept {
|
|
||||||
return Flags & InferContextFlags_PerviousEnv;
|
|
||||||
}
|
|
||||||
|
|
||||||
//inline InferContext(InferContext* Parent, TVSet& TVs, ConstraintSet& Constraints, TypeEnv& Env, Type* ReturnType):
|
//inline InferContext(InferContext* Parent, TVSet& TVs, ConstraintSet& Constraints, TypeEnv& Env, Type* ReturnType):
|
||||||
// Parent(Parent), TVs(TVs), Constraints(Constraints), Env(Env), ReturnType(ReturnType) {}
|
// Parent(Parent), TVs(TVs), Constraints(Constraints), Env(Env), ReturnType(ReturnType) {}
|
||||||
|
|
||||||
|
|
|
@ -86,14 +86,7 @@ namespace bolt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checker::addBinding(ByteString Name, Scheme* Scm) {
|
void Checker::addBinding(ByteString Name, Scheme* Scm) {
|
||||||
for (auto Iter = Contexts.rbegin(); Iter != Contexts.rend(); Iter++) {
|
Contexts.back()->Env.emplace(Name, Scm);
|
||||||
auto& Ctx = **Iter;
|
|
||||||
if (!Ctx.isEnvPervious()) {
|
|
||||||
Ctx.Env.emplace(Name, Scm);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ZEN_UNREACHABLE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Type* Checker::getReturnType() {
|
Type* Checker::getReturnType() {
|
||||||
|
|
Loading…
Reference in a new issue