Rename Checker::pushContext() to Checker::setContext()
This commit is contained in:
parent
63547ee0a5
commit
053d45868e
2 changed files with 8 additions and 8 deletions
|
@ -186,7 +186,7 @@ namespace bolt {
|
||||||
InferContext* ActiveContext;
|
InferContext* ActiveContext;
|
||||||
|
|
||||||
InferContext& getContext();
|
InferContext& getContext();
|
||||||
void pushContext(InferContext* Ctx);
|
void setContext(InferContext* Ctx);
|
||||||
void popContext();
|
void popContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -141,7 +141,7 @@ namespace bolt {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checker::pushContext(InferContext* Ctx) {
|
void Checker::setContext(InferContext* Ctx) {
|
||||||
ActiveContext = Ctx;
|
ActiveContext = Ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ namespace bolt {
|
||||||
{
|
{
|
||||||
auto Decl = static_cast<VariantDeclaration*>(X);
|
auto Decl = static_cast<VariantDeclaration*>(X);
|
||||||
|
|
||||||
pushContext(Decl->Ctx);
|
setContext(Decl->Ctx);
|
||||||
|
|
||||||
std::vector<TVar*> Vars;
|
std::vector<TVar*> Vars;
|
||||||
for (auto TE: Decl->TVs) {
|
for (auto TE: Decl->TVs) {
|
||||||
|
@ -353,7 +353,7 @@ namespace bolt {
|
||||||
{
|
{
|
||||||
auto Decl = static_cast<RecordDeclaration*>(X);
|
auto Decl = static_cast<RecordDeclaration*>(X);
|
||||||
|
|
||||||
pushContext(Decl->Ctx);
|
setContext(Decl->Ctx);
|
||||||
|
|
||||||
std::vector<TVar*> Vars;
|
std::vector<TVar*> Vars;
|
||||||
for (auto TE: Decl->Vars) {
|
for (auto TE: Decl->Vars) {
|
||||||
|
@ -446,7 +446,7 @@ namespace bolt {
|
||||||
|
|
||||||
auto Let = static_cast<LetDeclaration*>(N);
|
auto Let = static_cast<LetDeclaration*>(N);
|
||||||
|
|
||||||
pushContext(Let->Ctx);
|
setContext(Let->Ctx);
|
||||||
|
|
||||||
// If declaring a let-declaration inside a type class declaration,
|
// If declaring a let-declaration inside a type class declaration,
|
||||||
// we need to mark that the let-declaration requires this class.
|
// we need to mark that the let-declaration requires this class.
|
||||||
|
@ -547,7 +547,7 @@ namespace bolt {
|
||||||
|
|
||||||
void Checker::inferLetDeclaration(LetDeclaration* Decl) {
|
void Checker::inferLetDeclaration(LetDeclaration* Decl) {
|
||||||
|
|
||||||
pushContext(Decl->Ctx);
|
setContext(Decl->Ctx);
|
||||||
|
|
||||||
std::vector<Type*> ParamTypes;
|
std::vector<Type*> ParamTypes;
|
||||||
Type* RetType;
|
Type* RetType;
|
||||||
|
@ -889,7 +889,7 @@ namespace bolt {
|
||||||
}
|
}
|
||||||
Ty = createTypeVar();
|
Ty = createTypeVar();
|
||||||
for (auto Case: Match->Cases) {
|
for (auto Case: Match->Cases) {
|
||||||
pushContext(Case->Ctx);
|
setContext(Case->Ctx);
|
||||||
auto PattTy = inferPattern(Case->Pattern);
|
auto PattTy = inferPattern(Case->Pattern);
|
||||||
addConstraint(new CEqual(PattTy, ValTy, Case));
|
addConstraint(new CEqual(PattTy, ValTy, Case));
|
||||||
auto ExprTy = inferExpression(Case->Expression);
|
auto ExprTy = inferExpression(Case->Expression);
|
||||||
|
@ -1270,7 +1270,7 @@ namespace bolt {
|
||||||
|
|
||||||
void Checker::check(SourceFile *SF) {
|
void Checker::check(SourceFile *SF) {
|
||||||
initialize(SF);
|
initialize(SF);
|
||||||
pushContext(SF->Ctx);
|
setContext(SF->Ctx);
|
||||||
addBinding("String", new Forall(StringType));
|
addBinding("String", new Forall(StringType));
|
||||||
addBinding("Int", new Forall(IntType));
|
addBinding("Int", new Forall(IntType));
|
||||||
addBinding("Bool", new Forall(BoolType));
|
addBinding("Bool", new Forall(BoolType));
|
||||||
|
|
Loading…
Reference in a new issue