split addclass and generateCode