JS: postpone JS AST merging

This commit is contained in:
Anton Bannykh
2018-11-15 15:58:38 +03:00
parent ec276dbea4
commit c65383fa3f
12 changed files with 613 additions and 643 deletions
@@ -37,7 +37,7 @@ class JsAstSerializer(private val pathResolver: (File) -> String) {
private val importedNames = mutableSetOf<JsName>()
fun serialize(fragment: JsProgramFragment, output: OutputStream) {
val namesBySignature = fragment.nameBindings.associate { it.key to it.name }
val namesBySignature = fragment.nameBindings.associateTo(mutableMapOf()) { it.key to it.name }
importedNames.clear()
importedNames += fragment.imports.map { namesBySignature[it.key]!! }
serialize(fragment).writeTo(output)