Tree alloc = gen.New(gen.mkPrimaryConstr(tree.pos, sym.moduleClass()));
Tree alloc = gen.New(gen.mkApply__(gen.mkPrimaryConstructorLocalRef(tree.pos, sym.moduleClass())));
    private Tree[] transformModule(Tree tree, int mods, Name name, Tree tpe, Tree.Template templ) {	Symbol sym = tree.symbol();	Tree cdef = gen.ClassDef(sym.moduleClass(), templ);	if (sym.isGlobalModule()) return new Tree[]{cdef};	Tree alloc = gen.New(gen.mkPrimaryConstr(tree.pos, sym.moduleClass()));	{	    // var m$: T = null;	    Name varname = Name.fromString(name + "$");	    Symbol mvar = new TermSymbol(		tree.pos, varname, sym.owner(), PRIVATE | MUTABLE | SYNTHETIC)		.setInfo(sym.type());	    sym.owner().members().enterOrOverload(mvar);	    Tree vdef = gen.ValDef(mvar, gen.mkNullLit(tree.pos));	    // { if (null == m$) m$ = new m$class; m$ }	    Symbol eqMethod = getUnaryMemberMethod(		sym.type(), Names.EQEQ, defs.ANY_TYPE());	    Tree body = gen.Block(new Tree[]{		gen.If(		    gen.Apply(			gen.Select(gen.mkNullLit(tree.pos), eqMethod),			new Tree[]{gen.mkRef(tree.pos, mvar)}),		    gen.Assign(gen.mkRef(tree.pos, mvar), alloc),		    gen.Block(tree.pos, Tree.EMPTY_ARRAY)),		gen.mkRef(tree.pos, mvar)});	    // def m: T = { if (m$ == null[T]) m$ = new m$class; m$ }	    sym.flags |= STABLE;	    Tree ddef = gen.DefDef(sym, body);	    // def m_eq(m: T): Unit = { m$ = m }            Name m_eqname = name.append(Names._EQ);	    Symbol m_eq = new TermSymbol(		tree.pos, m_eqname, sym.owner(), PRIVATE | SYNTHETIC);            Symbol m_eqarg = new TermSymbol(tree.pos, name, m_eq, PARAM | SYNTHETIC)                .setType(sym.type());            m_eq.setInfo(                Type.MethodType(new Symbol[] {m_eqarg}, defs.UNIT_TYPE()));            Tree m_eqdef = gen.DefDef(m_eq,                gen.Assign(gen.mkRef(tree.pos, mvar), gen.Ident(tree.pos, m_eqarg)));            sym.owner().members().enterOrOverload(m_eq);	    return new Tree[]{cdef, vdef, ddef, m_eqdef};	}    }