if (sym.isModuleClass()) { Symbol module = (Symbol)modules.remove(sym); assert module != null: Debug.show(sym); writeRef(module); }
if (sym.isModuleClass()) writeRef(sym.sourceModule());
    private void writeSymbol(Symbol sym) {	if (debug) System.out.println("write " + sym);	if (isLocal(sym)) {	    switch (sym.kind) {	    case TYPE:		writeByte(TYPEsym);		break;	    case ALIAS:		writeByte(ALIASsym);		break;	    case CLASS:		writeByte(CLASSsym);		break;	    case VAL:		writeByte(VALsym);		break;	    default:		throw new ApplicationError();	    }	    writeByte(0); // space for length	    writeRef(sym.name);	    writeRef(sym.isConstructor() ? sym.constructorClass() : sym.owner());	    writeNat(sym.flags);	    switch (sym.kind) {	    case TYPE:		if (sym.isViewBounded()) writeRef(sym.vuBound());		else writeRef(sym.info());		writeRef(sym.loBound());		break;	    case ALIAS:		writeRef(sym.info());		writeRef(sym.allConstructors());		break;	    case CLASS:		writeRef(sym.info());                if (sym.isModuleClass()) {                    Symbol module = (Symbol)modules.remove(sym);                    assert module != null: Debug.show(sym);                    writeRef(module);                }		writeRef(sym.typeOfThis());		writeRef(sym.allConstructors());		break;	    case VAL:		writeRef(sym.info());		if (sym.isConstructor() && 		    sym == sym.constructorClass().allConstructors())		    writeRef(sym.constructorClass());		else if (sym.isModule())		    writeRef(sym.moduleClass());		break;	    default:		throw new ApplicationError();	    }	} else if (sym.kind == NONE) {	    writeByte(NONEsym);	    writeByte(0); // space for length	} else {	    if (sym.isModuleClass() || sym.isRoot()) {		writeByte(EXTMODCLASSref);		writeByte(0); // space for length		writeRef(sym.name.toTermName());	    } else {		writeByte(EXTref);		writeByte(0); // space for length		assert !sym.isConstructor() : sym;		writeRef(sym.name);	    }	    if (!sym.owner().isRoot())		writeRef(sym.owner());	}	sym.flags &= ~ALTERNATIVE;    }