JS backend: minor: refactor ClassTranslator