summaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2017-11-26 22:55:18 +0100
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-26 13:55:18 -0800
commit7390f6973eb99586083714e7ed49fa63c72c9c5d (patch)
tree2fc08957fad0a9276b7bf06f02d949b0232b67e8 /core/src/main
parent7bd320dcd9a1bfc59a80bc8237d293ee44b28f77 (diff)
downloadmill-7390f6973eb99586083714e7ed49fa63c72c9c5d.tar.gz
mill-7390f6973eb99586083714e7ed49fa63c72c9c5d.tar.bz2
mill-7390f6973eb99586083714e7ed49fa63c72c9c5d.zip
Check owner of method instead of linear search (#28)
Inherited methods from Object can be checked for owner instead of looking at the name of the method. This should be cleaner and faster, though probably below the margin of error at this point.
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/scala/mill/discover/Router.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/main/scala/mill/discover/Router.scala b/core/src/main/scala/mill/discover/Router.scala
index 90e83430..b2d222b9 100644
--- a/core/src/main/scala/mill/discover/Router.scala
+++ b/core/src/main/scala/mill/discover/Router.scala
@@ -254,7 +254,9 @@ class Router [C <: Context](val c: C) {
import c.universe._
def getValsOrMeths(curCls: Type): Iterable[MethodSymbol] = {
def isAMemberOfAnyRef(member: Symbol) = {
- weakTypeOf[AnyRef].members.exists(_.name == member.name)
+ // AnyRef is an alias symbol, we go to the real "owner" of these methods
+ val anyRefSym = c.mirror.universe.definitions.ObjectClass
+ member.owner == anyRefSym
}
val extractableMembers = for {
member <- curCls.members