@@ -79,7 +79,14 @@ abstract class TreePrinters {
7979 def printOpt (prefix : String , tree : Tree ): unit =
8080 if (! tree.isEmpty) { print(prefix); print(tree) }
8181
82- def printModifiers (flags : int): unit = {
82+ def printFlags (tree : Tree , flags : long): unit =
83+ printModifiers(
84+ if (tree.symbol == NoSymbol ) flags
85+ else if (settings.debug.value) tree.symbol.flags
86+ else tree.symbol.flags & SourceFlags .asInstanceOf [long]);
87+ // todo: check codegen so that we can remove this
88+
89+ def printModifiers (flags : long): unit = {
8390 val mask = if (settings.debug.value) - 1 else PrintableFlags ;
8491 val s = flagsToString(flags & mask);
8592 if (s.length() != 0 ) print(s + " " )
@@ -94,19 +101,19 @@ abstract class TreePrinters {
94101 print(" <empty>" );
95102
96103 case ClassDef (mods, name, tparams, tp, impl) =>
97- printModifiers( mods); print(" class " + symName(tree, name));
104+ printFlags(tree, mods); print(" class " + symName(tree, name));
98105 printTypeParams(tparams);
99106 printOpt(" : " , tp); print(" extends " ); print(impl);
100107
101108 case PackageDef (packaged, stats) =>
102109 print(" package " ); print(packaged); printColumn(stats, " {" , " ;" , " }" )
103110
104111 case ModuleDef (mods, name, impl) =>
105- printModifiers( mods); print(" object " + symName(tree, name));
112+ printFlags(tree, mods); print(" object " + symName(tree, name));
106113 print(" extends " ); print(impl);
107114
108115 case ValDef (mods, name, tp, rhs) =>
109- printModifiers( mods);
116+ printFlags(tree, mods);
110117 print(if ((mods & MUTABLE ) != 0 ) " var " else " val " );
111118 print(symName(tree, name));
112119 printOpt(" : " , tp);
@@ -116,16 +123,16 @@ abstract class TreePrinters {
116123 }
117124
118125 case DefDef (mods, name, tparams, vparamss, tp, rhs) =>
119- printModifiers( mods);
126+ printFlags(tree, mods);
120127 print(" def " + symName(tree, name));
121128 printTypeParams(tparams); vparamss foreach printValueParams;
122129 printOpt(" : " , tp); printOpt(" = " , rhs);
123130
124131 case AbsTypeDef (mods, name, lo, hi) =>
125- printModifiers( mods); print(" type " ); printParam(tree);
132+ printFlags(tree, mods); print(" type " ); printParam(tree);
126133
127134 case AliasTypeDef (mods, name, tparams, rhs) =>
128- printModifiers( mods); print(" type " + symName(tree, name));
135+ printFlags(tree, mods); print(" type " + symName(tree, name));
129136 printTypeParams(tparams); printOpt(" = " , rhs);
130137
131138 case LabelDef (name, params, rhs) =>
@@ -265,7 +272,7 @@ abstract class TreePrinters {
265272 case ClassDef (_, _, _, _, impl) => ClassDef (tree.symbol, impl)
266273 case ModuleDef (_, _, impl) => ModuleDef (tree.symbol, impl)
267274 case ValDef (_, _, _, rhs) => ValDef (tree.symbol, rhs)
268- case DefDef (_, _, _, _ , _, rhs) => DefDef (tree.symbol, vparamss => rhs)
275+ case DefDef (_, _, _, vparamss , _, rhs) => DefDef (tree.symbol, vparamss => rhs)
269276 case AbsTypeDef (_, _, _, _) => AbsTypeDef (tree.symbol)
270277 case AliasTypeDef (_, _, _, rhs) => AliasTypeDef (tree.symbol, rhs)
271278 case _ => tree
0 commit comments