Tree[] getInstArgs = new Tree[]{ gen.mkLocalRef(pos, vparams[0]) };
Tree[] getInstArgs = new Tree[]{ gen.mkLocalRef(pos, typesArr) };
        private Tree.DefDef instantiatorBody(Symbol clsSym, Symbol insSym) {            // TODO fix flags for all symbols below            final int pos = clsSym.pos;            final Symbol[] vparams = insSym.valueParams();            Tree[] body = new Tree[2];            // Generate call to "getInstantiation" method of            // constructor.            Tree getInstFun =                gen.Select(pos,                           gen.mkLocalRef(pos, getTConstructorSym(clsSym)),                           defs.TYPECONSTRUCTOR_GETINSTANTIATION());            Tree[] getInstArgs = new Tree[]{ gen.mkLocalRef(pos, vparams[0]) };            Symbol instVal =                insSym.newVariable(pos, 0, Name.fromString("inst"));            instVal.setInfo(defs.SCALACLASSTYPE_TYPE());            Tree instValDef =                gen.ValDef(instVal,                           gen.mkApply_V(pos, getInstFun, getInstArgs));            // Generate test to see if a call to "instantiate" is            // necessary.            Tree cond =                gen.mkApply_V(pos,                              gen.Select(pos,                                         gen.mkLocalRef(pos, instVal),                                         defs.ANY_BANGEQ),                              new Tree[] { gen.mkNullLit(pos) });            Tree thenP = gen.mkLocalRef(pos, instVal);            final HashMap varMap = new HashMap();            Symbol[] tparams = clsSym.typeParams();            for (int i = 0; i < tparams.length; ++i)                varMap.put(tparams[i], new Integer(i));            // Type environment mapping the type parameters of the            // class to their corresponding element in the "types"            // array passed to this instantiator.            TEnv tEnv = new TEnv() {                    public boolean definesVar(Symbol sym) {                        return varMap.containsKey(sym);                    }                    public Tree treeForVar(Symbol sym) {                        int idx = ((Integer)varMap.get(sym)).intValue();                        Tree array = gen.mkLocalRef(pos, vparams[0]);                        return gen.mkArrayGet(pos, array, idx);                    }                };            Type[] parents = clsSym.parents();            TreeList parentTypes = new TreeList();            for (int i = 0; i < parents.length; ++i) {                Type parent = parents[i];                if (!isStronglyTrivial(parent))                    parentTypes.append(typeAsValue(pos, parent, insSym, tEnv));            }            boolean emptyParents = (parentTypes.length() == 0);            Tree parentsArray = emptyParents                ? gen.mkGlobalRef(pos, defs.SCALACLASSTYPE_EMPTYARRAY())                : gen.mkNewArray(pos,                                 defs.SCALACLASSTYPE_TYPE(),                                 parentTypes.toArray(),                                 insSym);            Tree instFun =                gen.Select(pos,                           gen.mkLocalRef(pos, getTConstructorSym(clsSym)),                           defs.TYPECONSTRUCTOR_INSTANTIATE());            Tree[] instArgs = new Tree[] {                gen.mkLocalRef(pos, vparams[0]),                emptyParents ? parentsArray : gen.mkNullLit(pos)            };            Tree instCall = gen.mkApply_V(pos, instFun, instArgs);            Tree elseP;            if (!emptyParents) {                Tree setParentsFun =                    gen.Select(pos, instCall, defs.SCALACLASSTYPE_SETPARENTS());                elseP = gen.mkApply_V(pos,                                      setParentsFun,                                      new Tree[] { parentsArray });            } else                elseP = instCall;            Tree ifExpr =                gen.If(pos, cond, thenP, elseP, defs.SCALACLASSTYPE_TYPE());            return gen.DefDef(insSym, gen.mkBlock(pos, instValDef, ifExpr));        }