mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
Moved OverDeclaration.isUnique to funcsem (#21174)
This commit is contained in:
parent
c1eeb9b170
commit
857d4a64c8
3 changed files with 20 additions and 21 deletions
|
@ -27,7 +27,7 @@ import dmd.dtemplate;
|
|||
import dmd.errors;
|
||||
import dmd.expression;
|
||||
import dmd.func;
|
||||
import dmd.funcsem : overloadApply, getLevelAndCheck;
|
||||
import dmd.funcsem : getLevelAndCheck;
|
||||
import dmd.globals;
|
||||
import dmd.gluelayer;
|
||||
import dmd.hdrgen;
|
||||
|
@ -783,25 +783,6 @@ extern (C++) final class OverDeclaration : Declaration
|
|||
return true;
|
||||
}
|
||||
|
||||
Dsymbol isUnique()
|
||||
{
|
||||
Dsymbol result = null;
|
||||
overloadApply(aliassym, (Dsymbol s)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
result = null;
|
||||
return 1; // ambiguous, done
|
||||
}
|
||||
else
|
||||
{
|
||||
result = s;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
override void accept(Visitor v)
|
||||
{
|
||||
v.visit(this);
|
||||
|
|
|
@ -6822,7 +6822,6 @@ public:
|
|||
bool equals(const RootObject* const o) const override;
|
||||
bool overloadInsert(Dsymbol* s) override;
|
||||
bool isOverloadable() const override;
|
||||
Dsymbol* isUnique();
|
||||
void accept(Visitor* v) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -3664,3 +3664,22 @@ extern (D) int overloadApply(Dsymbol fstart, scope int delegate(Dsymbol) dg, Sco
|
|||
}
|
||||
return overloadApplyRecurse(fstart, dg, sc);
|
||||
}
|
||||
|
||||
Dsymbol isUnique(OverDeclaration od)
|
||||
{
|
||||
Dsymbol result = null;
|
||||
overloadApply(od.aliassym, (Dsymbol s)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
result = null;
|
||||
return 1; // ambiguous, done
|
||||
}
|
||||
else
|
||||
{
|
||||
result = s;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue