diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-15 14:48:53 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-15 14:48:53 +0200 |
commit | 5c4496a2fc710d5f969fe9891b92e22ecec34057 (patch) | |
tree | c6cdf0eb1a7d4eda6789c9e5e467cd136893b3ba | |
parent | 7ec75f35e192a795945e889bf383ef02521e4b69 (diff) | |
download | dotty-5c4496a2fc710d5f969fe9891b92e22ecec34057.tar.gz dotty-5c4496a2fc710d5f969fe9891b92e22ecec34057.tar.bz2 dotty-5c4496a2fc710d5f969fe9891b92e22ecec34057.zip |
Refactor code into nested method
mergeDenot is already large as it is.
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 132f04aa9..a41ebbdba 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -339,17 +339,18 @@ object Denotations { def prefer(sym1: Symbol, sym2: Symbol, info1: Type, info2: Type) = preferSym(sym1, sym2) && info1.overrides(info2) + def handleDoubleDef = + if (preferSym(sym1, sym2)) denot1 + else if (preferSym(sym2, sym1)) denot2 + else doubleDefError(denot1, denot2, pre) + if (sym2Accessible && prefer(sym2, sym1, info2, info1)) denot2 else { val sym1Accessible = sym1.isAccessibleFrom(pre) if (sym1Accessible && prefer(sym1, sym2, info1, info2)) denot1 else if (sym1Accessible && sym2.exists && !sym2Accessible) denot1 else if (sym2Accessible && sym1.exists && !sym1Accessible) denot2 - else if (isDoubleDef(sym1, sym2)) { - if (preferSym(sym1, sym2)) denot1 - else if (preferSym(sym2, sym1)) denot2 - else doubleDefError(denot1, denot2, pre) - } + else if (isDoubleDef(sym1, sym2)) handleDoubleDef else { val sym = if (!sym1.exists) sym2 |