From 2d2a3e92de0a7bd0cd01f93496527737b1be0381 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 17 Oct 2011 20:59:28 +0000 Subject: Cleaning up debug logging. No review. --- src/compiler/scala/reflect/internal/Trees.scala | 13 +++++++++---- .../scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 11 ++++++++--- .../scala/tools/nsc/transform/SpecializeTypes.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 4 ++-- src/compiler/scala/tools/nsc/util/Position.scala | 1 + 6 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/reflect/internal/Trees.scala b/src/compiler/scala/reflect/internal/Trees.scala index d4e2550698..88eb79c9d8 100644 --- a/src/compiler/scala/reflect/internal/Trees.scala +++ b/src/compiler/scala/reflect/internal/Trees.scala @@ -129,11 +129,16 @@ trait Trees extends api.Trees { self: SymbolTable => * less than the whole tree. */ def summaryString: String = tree match { - case Select(qual, name) => qual.summaryString + "." + name + case Select(qual, name) => qual.summaryString + "." + name.decode case Ident(name) => name.longString - case t: DefTree => t.shortClass + " " + t.name - case t: RefTree => t.shortClass + " " + t.name.longString - case t => t.shortClass + case Literal(const) => "Literal(" + const + ")" + case t: DefTree => t.shortClass + " `" + t.name.decode + "`" + case t: RefTree => t.shortClass + " `" + t.name.longString + "`" + case t => + t.shortClass + ( + if (t.symbol != null && t.symbol != NoSymbol) " " + t.symbol + else "" + ) } } diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index fc150d3361..44ac9c68cf 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -54,6 +54,8 @@ abstract class ClassfileParser { } def parse(file: AbstractFile, root: Symbol) = try { + debuglog("[class] >> " + root.fullName) + def handleMissing(e: MissingRequirementError) = { if (settings.debug.value) e.printStackTrace throw new IOException("Missing dependency '" + e.req + "', required by " + in.file) @@ -82,7 +84,6 @@ abstract class ClassfileParser { println("Skipping class: " + root + ": " + root.getClass) } */ - debuglog("parsing " + file.name) this.in = new AbstractFileReader(file) if (root.isModule) { this.clazz = root.companionClass @@ -907,8 +908,12 @@ abstract class ClassfileParser { case None => throw new RuntimeException("Scala class file does not contain Scala annotation") } - debuglog("" + sym + "; annotations = " + sym.rawAnnotations) - } else + debuglog("[class] << " + sym.fullName + ( + if (sym.rawAnnotations.isEmpty) "" + else sym.rawAnnotations.mkString("(", ", ", ")")) + ) + } + else in.skip(attrLen) // TODO 1: parse runtime visible annotations on parameters diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 80971b9917..71e1fecbd7 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1309,7 +1309,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { case Select(qual, name) => debuglog("[%s] looking at Select: %s sym: %s: %s [tree.tpe: %s]".format( - tree.pos.line, tree, symbol, symbol.info, tree.tpe)) + tree.pos.safeLine, tree, symbol, symbol.info, tree.tpe)) //log("!!! select " + tree + " -> " + symbol.info + " specTypeVars: " + specializedTypeVars(symbol.info)) if (specializedTypeVars(symbol.info).nonEmpty && name != nme.CONSTRUCTOR) { diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index c5304ca103..d252281002 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -193,7 +193,7 @@ trait Contexts { self: Analyzer => c.retyping = this.retyping c.openImplicits = this.openImplicits registerContext(c.asInstanceOf[analyzer.Context]) - debuglog("Created context: " + this + " ==> " + c) + debuglog("[context] ++ " + c.unit + " / " + tree.summaryString) c } diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 8dd23d14f3..e70d477a87 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -375,7 +375,7 @@ trait Namers { self: Analyzer => || sym.owner.info.member(nme.copy).isSynthetic ) - debuglog("entered " + sym + " in " + context.owner + ", scope-id = " + context.scope.## ) + debuglog("entered " + sym + " in " + context.owner) var ltype = namerOf(sym).typeCompleter(tree) if (tparams nonEmpty) { //@M! TypeDef's type params are handled differently @@ -644,7 +644,7 @@ trait Namers { self: Analyzer => // --- Lazy Type Assignment -------------------------------------------------- def typeCompleter(tree: Tree) = mkTypeCompleter(tree) { sym => - debuglog("defining " + sym + flagsToString(sym.flags)+sym.locationString) + debuglog("defining " + flagsToString(sym.flags) + " " + sym.fullLocationString) val tp = typeSig(tree) tp match { case TypeBounds(lo, hi) => diff --git a/src/compiler/scala/tools/nsc/util/Position.scala b/src/compiler/scala/tools/nsc/util/Position.scala index 68d0359dfe..a1ec90ed3f 100644 --- a/src/compiler/scala/tools/nsc/util/Position.scala +++ b/src/compiler/scala/tools/nsc/util/Position.scala @@ -189,6 +189,7 @@ trait Position { if (source == null) this else source.positionInUltimateSource(this) def dbgString = toString + def safeLine = try line catch { case _: UnsupportedOperationException => -1 } def show: String = "["+toString+"]" } -- cgit v1.2.3