summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/internal/Symbols.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-04-18 12:22:59 +0100
committerPaul Phillips <paulp@improving.org>2012-04-18 14:59:22 +0100
commit016bc3db52d6f1ffa3ef2285d5801f82f5f49167 (patch)
tree0915586ab8fe0f4019245e655f5f31e9d83649c3 /src/compiler/scala/reflect/internal/Symbols.scala
parent8a285258fdb37af9f4ba8ced0a5c8fb6fefbf62c (diff)
downloadscala-016bc3db52d6f1ffa3ef2285d5801f82f5f49167.tar.gz
scala-016bc3db52d6f1ffa3ef2285d5801f82f5f49167.tar.bz2
scala-016bc3db52d6f1ffa3ef2285d5801f82f5f49167.zip
Minor optimizations with nested list operations.
I also tried transforming a comment into an assertion and to my shock and happy surprise everything still worked. Let's express those preconditions in code when we can, mmm?
Diffstat (limited to 'src/compiler/scala/reflect/internal/Symbols.scala')
-rw-r--r--src/compiler/scala/reflect/internal/Symbols.scala17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala
index 74e924add4..c9ac929edf 100644
--- a/src/compiler/scala/reflect/internal/Symbols.scala
+++ b/src/compiler/scala/reflect/internal/Symbols.scala
@@ -718,13 +718,8 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
*/
final def isMonomorphicType =
isType && {
- var is = infos
- (is eq null) || {
- while (is.prev ne null) { is = is.prev }
- is.info.isComplete && !is.info.isHigherKinded // was: is.info.typeParams.isEmpty.
- // YourKit listed the call to PolyType.typeParams as a hot spot but it is likely an artefact.
- // The change to isHigherKinded did not reduce the total running time.
- }
+ val info = originalInfo
+ info.isComplete && !info.isHigherKinded
}
def isStrictFP = hasAnnotation(ScalaStrictFPAttr) || (enclClass hasAnnotation ScalaStrictFPAttr)
@@ -1126,6 +1121,14 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
// ------ info and type -------------------------------------------------------------------
private[Symbols] var infos: TypeHistory = null
+ def originalInfo = {
+ if (infos eq null) null
+ else {
+ var is = infos
+ while (is.prev ne null) { is = is.prev }
+ is.info
+ }
+ }
/** Get type. The type of a symbol is:
* for a type symbol, the type corresponding to the symbol itself,