Skip to content

Commit

Permalink
Attempt #2 to optimize findMember
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky authored and adriaanm committed Jul 14, 2012
1 parent 1a73aa0 commit 41f4497
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/compiler/scala/tools/nsc/Driver.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package scala.tools.nsc

import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
import Properties.{ versionString, copyrightString }
import Properties.{ versionString, copyrightString, residentPromptString }
import scala.reflect.internal.util.{ BatchSourceFile, FakePos }

abstract class Driver {

val prompt = residentPromptString

val versionMsg = "Scala compiler " +
versionString + " -- " +
Expand Down
6 changes: 2 additions & 4 deletions src/compiler/scala/tools/nsc/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import scala.tools.nsc.interactive.{ RefinedBuildManager, SimpleBuildManager }
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
import scala.reflect.internal.util.{ BatchSourceFile, FakePos } //{Position}
import Properties.{ versionString, copyrightString, residentPromptString, msilLibPath }
import Properties.msilLibPath

/** The main class for NSC, a compiler for the programming
* language Scala.
* language Scala.
*/
object Main extends Driver with EvalLoop {

val prompt = residentPromptString

def resident(compiler: Global) {
loop { line =>
val args = line.split(' ').toList
Expand Down
14 changes: 7 additions & 7 deletions src/reflect/scala/reflect/internal/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ trait Types extends api.Types { self: SymbolTable =>
while (!bcs.isEmpty) {
val decls = bcs.head.info.decls
var entry =
if (name == nme.ANYNAME) decls.elems
if (name eq nme.ANYNAME) decls.elems
else if ((fingerPrint & decls.fingerPrints) == 0) null
else decls.lookupEntry(name)
while (entry ne null) {
Expand All @@ -1069,12 +1069,12 @@ trait Types extends api.Types { self: SymbolTable =>
Statistics.popTimer(typeOpsStack, start)
if (suspension ne null) suspension foreach (_.suspended = false)
return sym
} else if (member == NoSymbol) {
} else if (member eq NoSymbol) {
member = sym
} else if (members eq null) {
if (member.name != sym.name ||
!(member == sym ||
member.owner != sym.owner &&
if ((member.name ne sym.name) ||
!((member eq sym) ||
(member.owner ne sym.owner) &&
!sym.isPrivate && {
if (self eq null) self = this.narrow
if (membertpe eq null) membertpe = self.memberType(member)
Expand All @@ -1088,8 +1088,8 @@ trait Types extends api.Types { self: SymbolTable =>
var prevEntry = members.lookupEntry(sym.name)
var symtpe: Type = null
while ((prevEntry ne null) &&
!(prevEntry.sym == sym ||
prevEntry.sym.owner != sym.owner &&
!((prevEntry.sym eq sym) ||
(prevEntry.sym.owner ne sym.owner) &&
!sym.hasFlag(PRIVATE) && {
if (self eq null) self = this.narrow
if (symtpe eq null) symtpe = self.memberType(sym)
Expand Down

0 comments on commit 41f4497

Please sign in to comment.