7c4033f0bf
Top-level initializers must be deserialized in the same order they where in the original source file. Before this patch this rule might be violated. Consider the following case: // lib1.kt val a = 5 val b = a * 5 // lib2.kt fun foo() = println(b) Compile both files into libraries and then link an application against them. During deserialization of lib2 'b' will be added to the deserialization queue of lib1. After that we will add 'a' to this queue too. Thus 'b' and 'a' will be in a wrong order in this queue resulting in a wrong order of corresponding top-level initializers in a final executable. This patch fixes this issue by adding all top-level initializers to a deserialization queue before all other declarations.