diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-02 16:11:20 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-02 16:30:16 +0200 |
commit | e5618d29e37ad50bd1b8c591ed50db63a6d7bc79 (patch) | |
tree | 1d53beeccaaddcfa20e2080a4c7e0feffab673c5 /src/dotty/tools/dotc/core/Symbols.scala | |
parent | c560648f191f325cc1961f25fdbad48839ca6327 (diff) | |
download | dotty-e5618d29e37ad50bd1b8c591ed50db63a6d7bc79.tar.gz dotty-e5618d29e37ad50bd1b8c591ed50db63a6d7bc79.tar.bz2 dotty-e5618d29e37ad50bd1b8c591ed50db63a6d7bc79.zip |
Simplify methods implemented in #436
Diffstat (limited to 'src/dotty/tools/dotc/core/Symbols.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 97fe1f23e..0b50187a5 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -161,20 +161,14 @@ trait Symbols { this: Context => owner.thisType, modcls, parents, decls, TermRef.withSymAndName(owner.thisType, module, name)), privateWithin, coord, assocFile) - def synthesizeCompanionMethod(name: TermName, ret: SymDenotation, owner: SymDenotation)(implicit ctx: Context) = { - if(owner.exists && ret.exists && !owner.isAbsent && !ret.isAbsent) { + def synthesizeCompanionMethod(name: Name, target: SymDenotation, owner: SymDenotation)(implicit ctx: Context) = + if(owner.exists && target.exists && !owner.isAbsent && !target.isAbsent) { val existing = owner.unforcedDecls.lookup(name) - if (existing.exists) existing - else - ctx.newSymbol( - owner = owner.symbol, - name = name, - flags = Flags.Synthetic | Flags.Private, - info = ExprType(ret.typeRef)) - } - else NoSymbol - } + existing.orElse{ + ctx.newSymbol(owner.symbol, name, Flags.Synthetic | Flags.Private, ExprType(target.typeRef)) + } + } else NoSymbol /** Create a package symbol with associated package class * from its non-info fields and a lazy type for loading the package's members. |