if (inClassContext && sym.owner().isPrimaryConstructor())
if (inClassContext && name.isTermName() && sym.owner().isPrimaryConstructor())
    public Tree transform(Tree tree) {        switch (tree) {        case ClassDef(int mods, // :                      Name name,                      Tree.TypeDef[] tparams,                      Tree.ValDef[][] vparams,                      Tree tpe,                      Tree.Template impl): {            Symbol clsSym = tree.symbol();            Symbol constrSym = clsSym.constructor();            LinkedList/*<Tree>*/ newBody =                new LinkedList(Arrays.asList(transform(impl.body)));            // Add value definitions and accessors for all constructor            // arguments which were found in the body of the class.            assert vparams.length == 1;            Tree.ValDef[] params = vparams[0];            Scope newMembers = new Scope(clsSym.members());            for (int i = 0; i < params.length; ++i) {                Symbol paramSym = params[i].symbol();                if (accessorMap.containsKey(paramSym)) {                    Symbol accessorSym = (Symbol)accessorMap.get(paramSym);                    Symbol valSym = new TermSymbol(paramSym.pos,                                                   valName(paramSym),                                                   clsSym,                                                   Modifiers.PRIVATE);                    valSym.setType(paramSym.type());                    newBody.addFirst(gen.DefDef(accessorSym, gen.Ident(valSym)));                    newMembers.enter(accessorSym);                    newBody.addFirst(gen.ValDef(valSym, gen.Ident(paramSym)));                    newMembers.enter(valSym);                }            }            // Update class type with new values/accessors.            switch (clsSym.info()) {            case CompoundType(Type[] basetypes, Scope members):                clsSym.updateInfo(Type.compoundType(basetypes, newMembers, clsSym));                break;            default:                Debug.abort("unexpected type", clsSym.info());            }            assert inClassContext;            inClassContext = false;            Tree[] newParents = transform(impl.parents);            inClassContext = true;            Tree[] newBodyA = (Tree[])newBody.toArray(new Tree[newBody.size()]);            return copy.ClassDef(tree,                                 mods,                                 name,                                 transform(tparams),                                 transform(vparams),                                 transform(tpe),                                 copy.Template(impl, newParents, newBodyA));        }        case Select(Tree qualifier, Name selector): {            Symbol sym = tree.symbol();            if (sym.owner().isPrimaryConstructor())                return gen.Apply(gen.Select(transform(qualifier), accessor(sym)),                                 Tree.EMPTY_ARRAY);            else                return copy.Select(tree, transform(qualifier), selector);        }        case Ident(Name name): {            Symbol sym = tree.symbol();            if (inClassContext && sym.owner().isPrimaryConstructor())                return gen.Apply(gen.Ident(accessor(sym)), Tree.EMPTY_ARRAY);            else                return copy.Ident(tree, name);        }        default:            return super.transform(tree);        }    }