diff options
author | Adriaan Moors <adriaan@lightbend.com> | 2016-06-02 15:37:30 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan@lightbend.com> | 2016-06-02 15:37:30 -0700 |
commit | 461c896581a6e16d1b79e91e9322eb2d14dc53d2 (patch) | |
tree | 767b34e2f6e9aa1134068b801a31ac8366ac33b9 /src/reflect | |
parent | 3cbe3e89264ad63c9b86ea4962da553a24bfb128 (diff) | |
parent | 6cd356a9ffc2054f2a3d729a47ceae13c7575e09 (diff) | |
download | scala-461c896581a6e16d1b79e91e9322eb2d14dc53d2.tar.gz scala-461c896581a6e16d1b79e91e9322eb2d14dc53d2.tar.bz2 scala-461c896581a6e16d1b79e91e9322eb2d14dc53d2.zip |
Merge pull request #5205 from adriaanm/misc-opt
Small optimizations around use of Scopes.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Definitions.scala | 7 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 6 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index ca6c893d13..fe6d88e7c7 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -863,12 +863,13 @@ trait Definitions extends api.StandardDefinitions { // Scopes() // must filter out "universal" members (getClass is deferred for some reason) val deferredMembers = ( - tp membersBasedOnFlags (excludedFlags = BridgeAndPrivateFlags, requiredFlags = METHOD) - filter (mem => mem.isDeferredNotJavaDefault && !isUniversalMember(mem)) // TODO: test + tp.membersBasedOnFlags(excludedFlags = BridgeAndPrivateFlags, requiredFlags = METHOD).toList.filter( + mem => mem.isDeferredNotJavaDefault && !isUniversalMember(mem) + ) // TODO: test ) // if there is only one, it's monomorphic and has a single argument list - if (deferredMembers.size == 1 && + if (deferredMembers.lengthCompare(1) == 0 && deferredMembers.head.typeParams.isEmpty && deferredMembers.head.info.paramSectionCount == 1) deferredMembers.head diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 49202cd71e..97b7f239f0 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2036,11 +2036,9 @@ trait Symbols extends api.Symbols { self: SymbolTable => } } } - private final def caseFieldAccessorsUnsorted: List[Symbol] = - (info.decls filter (_.isCaseAccessorMethod)).toList + private final def caseFieldAccessorsUnsorted: List[Symbol] = info.decls.toList.filter(_.isCaseAccessorMethod) - final def constrParamAccessors: List[Symbol] = - info.decls.filter(sym => !sym.isMethod && sym.isParamAccessor).toList + final def constrParamAccessors: List[Symbol] = info.decls.toList.filter(sym => !sym.isMethod && sym.isParamAccessor) /** The symbol accessed by this accessor (getter or setter) function. */ final def accessed: Symbol = { |