diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-31 11:02:43 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-17 11:56:16 -0800 |
commit | 1f4f1235920fe87e1b1bdfd042683d9651f1d4f1 (patch) | |
tree | 17cdd0e5afa72c5cfe4341a75ca6836c909b894b /src/compiler/scala/reflect/internal/Symbols.scala | |
parent | 35b81d14778d2c6e8392ae51c53652f48b52b488 (diff) | |
download | scala-1f4f1235920fe87e1b1bdfd042683d9651f1d4f1.tar.gz scala-1f4f1235920fe87e1b1bdfd042683d9651f1d4f1.tar.bz2 scala-1f4f1235920fe87e1b1bdfd042683d9651f1d4f1.zip |
Optimizations.
Do cheap tests like x.isImplicit before expensive tests like
matchesQuantified. Don't fail to notice that substSym has been
called with an empty "from" list and traverse everything anyway.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Symbols.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index 77ed2f6a1b..b3ff2c6329 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -1023,8 +1023,11 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** Modifies this symbol's info in place. */ def modifyInfo(f: Type => Type): this.type = setInfo(f(info)) /** Substitute second list of symbols for first in current info. */ - def substInfo(syms0: List[Symbol], syms1: List[Symbol]) = modifyInfo(_.substSym(syms0, syms1)) - def setInfoOwnerAdjusted(info: Type): this.type = setInfo(info atOwner this) + def substInfo(syms0: List[Symbol], syms1: List[Symbol]): this.type = + if (syms0.isEmpty) this + else modifyInfo(_.substSym(syms0, syms1)) + + def setInfoOwnerAdjusted(info: Type): this.type = setInfo(info atOwner this) /** Set the info and enter this symbol into the owner's scope. */ def setInfoAndEnter(info: Type): this.type = { |