for (int i = 0; i < body.length; i++) { Tree t = body[i]; if (t.definesSymbol()) { Symbol sym = t.symbol(); switch (t) { case ValDef(_, _, _, Tree rhs): if (rhs != Tree.Empty) {   Tree ident = gen.Ident(sym);  constrBody.add (gen.Assign(t.pos, ident, transform(rhs))); t = gen.ValDef(sym, Tree.Empty); } break; } classBody.add(transform(t)); classScope.enterOrOverload(sym); } else  constrBody.add(transform(t)); }
constrBody.addAll(constrBody2);
    public Tree transform(Tree tree) {	Symbol treeSym = tree.symbol();	switch (tree) {	case ClassDef(_, _, _, ValDef[][] vparams, _, //:		      Template(Tree[] baseClasses, Tree[] body)):	    assert treeSym.name.isTypeName();	    if (treeSym.isInterface())		return super.transform(tree);	    Symbol[] paramSyms = new Symbol[vparams[0].length];	    for (int i = 0; i < paramSyms.length; i++)		paramSyms[i] = vparams[0][i].symbol();	    ArrayList constrBody = new ArrayList();	    ArrayList classBody = new ArrayList();	    Symbol constrSym =		getConstructor(treeSym.constructor(), paramSyms, treeSym);	    Scope classScope = new Scope();	    classScope.enter(constrSym);	    assert constrSym.owner() == treeSym :		"Wrong owner of the constructor: \n\tfound: " +		Debug.show(constrSym.owner()) + "\n\texpected: " +		Debug.show(treeSym);	    // inline the call to the super constructor            Type superType = treeSym.parents()[0];            if ( !forINT || !superType.symbol().isJava()) {		switch (baseClasses[0]) {		case Apply(Tree fun, Tree[] args):		    int pos = baseClasses[0].pos;		    Tree superConstr = gen.Select			(gen.Super(pos, superType),			 getConstructor(fun.symbol()));		    constrBody.add(gen.Apply(superConstr, transform(args)));		    break;		default: 		    new scalac.ast.printer.TextTreePrinter().print(baseClasses[0]).println().end();		    assert false;		}	    }	    // inline initialization of module values            if (forINT && treeSym.isModuleClass()) {                Symbol module = treeSym.module();                if (module.isGlobalModule()) {                    constrBody.add(                        gen.Assign(                            gen.mkRef(tree.pos, module),                            gen.This(tree.pos, treeSym)));                } else {                    Symbol owner = module.owner();                    Name module_eqname = module.name.append(Names._EQ);                    Symbol module_eq = owner.lookup(module_eqname);                    assert module != Symbol.NONE :Debug.show(treeSym.module());                    if (owner.isModuleClass() && owner.module().isStable()) {                        constrBody.add(                            gen.Apply(                                gen.mkRef(tree.pos, module_eq),                                new Tree[] {gen.This(tree.pos, treeSym)}));                    } else {                        // !!! module_eq must be accessed via some outer field                    }                }            }	    // for every ValDef move the initialization code into the constructor	    for (int i = 0; i < body.length; i++) {		Tree t = body[i];		if (t.definesSymbol()) {		    Symbol sym = t.symbol();		    switch (t) {		    case ValDef(_, _, _, Tree rhs):			if (rhs != Tree.Empty) {			    // !!!FIXME: revert to this.whatever when the bug is fixed			    //Tree ident = gen.Select(gen.This(t.pos, treeSym), sym);			    Tree ident = gen.Ident(sym);			    constrBody.add				(gen.Assign(t.pos, ident, transform(rhs)));			    t = gen.ValDef(sym, Tree.Empty);			}			break;		    }		    classBody.add(transform(t));		    classScope.enterOrOverload(sym);		} else		    // move every class-level expression into the constructor		    constrBody.add(transform(t));	    }	    // add result expression consistent with the	    // result type of the constructor            if (! forJVM)                constrBody.add(gen.This(tree.pos, treeSym));            Tree constrTree = constrBody.size() > 1 ?                gen.Block((Tree[])constrBody.			  toArray(new Tree[constrBody.size()])):                (Tree) constrBody.get(0);	    classBody.add(gen.DefDef(tree.pos, constrSym, constrTree));	    // strip off the class constructor from parameters	    switch (treeSym.constructor().info()) {	    case MethodType(_, Type result):		treeSym.constructor().		    updateInfo(Type.MethodType(Symbol.EMPTY_ARRAY, result));		break;	    default : assert false;	    }	    Type classType =		Type.compoundType(treeSym.parents(), classScope, treeSym);	    Symbol classSym = treeSym.updateInfo(classType);	    Tree[] newBody = (Tree[]) classBody.toArray(Tree.EMPTY_ARRAY);	    return gen.ClassDef(classSym, baseClasses, newBody);	// Substitute the constructor into the 'new' expressions	case New(Template(Tree[] baseClasses, _)):	    Tree base = baseClasses[0];	    switch (base) {	    case Apply(Tree fun, Tree[] args):                return gen.New(copy.Apply			       (base,				gen.Ident(base.pos, getConstructor(fun.symbol())),				transform(args)));	    default:		assert false;	    }	    break;	} // switch(tree)	return super.transform(tree);    } // transform()