Skip to content

Commit

Permalink
Rename the FuncDeclaration overload of checkNestedReference
Browse files Browse the repository at this point in the history
To distinguish it from the `VarDeclaration` overload that does something quite different.
  • Loading branch information
thewilsonator committed Oct 6, 2024
1 parent c600822 commit 349e35a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -5571,7 +5571,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
}
else if (auto f = e.var.isFuncDeclaration())
{
if (f.checkNestedReference(sc, e.loc))
if (f.checkNestedFuncReference(sc, e.loc))
return setError();
}

Expand Down Expand Up @@ -5625,10 +5625,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
}
else if (fd)
{
// TODO: If fd isn't yet resolved its overload, the checkNestedReference
// TODO: If fd isn't yet resolved its overload, the checkNestedFuncReference
// call would cause incorrect validation.
// Maybe here should be moved in CallExp, or AddrExp for functions.
if (fd.checkNestedReference(sc, e.loc))
if (fd.checkNestedFuncReference(sc, e.loc))
return setError();
}
else if (auto od = e.var.isOverDeclaration())
Expand Down Expand Up @@ -6727,7 +6727,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
exp.f.checkPurity(exp.loc, sc);
exp.f.checkSafety(exp.loc, sc);
exp.f.checkNogc(exp.loc, sc);
if (exp.f.checkNestedReference(sc, exp.loc))
if (exp.f.checkNestedFuncReference(sc, exp.loc))
return setError();
}
else if (sc.func && sc.intypeof != 1 && !(sc.ctfe || sc.debug_))
Expand Down Expand Up @@ -6810,7 +6810,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
if (exp.f.needThis())
{
// Change the ancestor lambdas to delegate before hasThis(sc) call.
if (exp.f.checkNestedReference(sc, exp.loc))
if (exp.f.checkNestedFuncReference(sc, exp.loc))
return setError();

auto memberFunc = hasThis(sc);
Expand Down Expand Up @@ -6845,7 +6845,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor

checkFunctionAttributes(exp, sc, exp.f);
checkAccess(exp.loc, sc, null, exp.f);
if (exp.f.checkNestedReference(sc, exp.loc))
if (exp.f.checkNestedFuncReference(sc, exp.loc))
return setError();

ethis = null;
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/funcsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -2272,9 +2272,9 @@ bool canInferAttributes(FuncDeclaration fd, Scope* sc)
* then mark it as a delegate.
* Returns true if error occurs.
*/
bool checkNestedReference(FuncDeclaration fd, Scope* sc, const ref Loc loc)
bool checkNestedFuncReference(FuncDeclaration fd, Scope* sc, const ref Loc loc)
{
//printf("FuncDeclaration::checkNestedReference() %s\n", toPrettyChars());
//printf("FuncDeclaration::checkNestedFuncReference() %s\n", toPrettyChars());
if (auto fld = fd.isFuncLiteralDeclaration())
{
if (fld.tok == TOK.reserved)
Expand Down

0 comments on commit 349e35a

Please sign in to comment.