faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.29k stars 86 forks source link

Write Strict.* statements at the end of output #343

Closed kfish closed 10 years ago

kfish commented 10 years ago

This fixes a bug in generation of --strict wrappers, where a value is serialized before the serialization code for the object is added to the hash. Instead we place the Strict.* statements at the end of the generated code.

As compileFileWithSource is called recursively on imported files, this patch changes the type of compiler output to ([JsStmt], [JsStmt]), being a tuple of the initial (header) and final (footer) statements. These are formed separately and finally joined together in compileTopLevelModule.