Skip to content
A strongly-typed language that compiles to JavaScript
Haskell PureScript Yacc CSS Shell JavaScript Other
Branch: master
Clone or download

Latest commit

citizengabe Have module re-exports appear in generated code (#3883)
* Add re-exports to Language.PureScript.CoreFn.Module

We need to make the `ExportSource` from
`Language.PureScript.AST.Declarations.ReExportRef` available during code-gen.
This requires adding it to `Module`.

We don't actually do the work of adding the data in this commit, we merely add
the field, update the JSON codecs, appease the compiler, and add a test for
parsing the new field.

* Add source of re-export to the module

Now that we have a field for them, we add the re-exports to the module so they
show up as both imported modules and exported members during code-gen.

* Generate imports for re-exports

Now that we're threading the necessary information down to `moduleToJs`, we can
use it to generate the imports we need to later re-export.

* Add re-exports to the generated code

We build up the key/value pairs for the re-exports and append them to the rest
of the exports.

This broke bundling and required allowing `<module name>.<member name>` in
addition to `$foreign.<member name>`. This is the only place where I'm unsure of
my changes.

* Handle bracket notation for re-exports while bundling

In the last commit, we handled the case of member access using dot notation, but
the passing tests were a fluke of caching. Now both cases are handled and tests
are passing.

* Add CitizenNet and my CitizenNet account to CONTRIBUTORS.md

I have a separate account that I use for work and prefer to include this in
addition to my personal acccount to differentiate who owns the copyright for
what work.

I also add my employer to the list of companies holding copyright.

* Handle `Language.PureScript.CoreFn.exportToCoreFn` cases explicitly

Previously, it was possible to forget to handle new constructors added to
`DeclarationRef`. Now we handle them explicitly thus eliminating this potential
source of bugs.

* Test re-exports appear in generated code

As suggested by @hdgarrood in
#3883 (review),
we use the FFI to import a re-exported value.

Module `A` defines a value `a`, module `B` re-exports `A`, and module `Main`
does a foreign import of `a` via `B`. Logging the imported value proves that
the re-export chain was successful.

* Add more conditions to re-export test

We tested that the value defined in one module could be re-exported and then
imported via FFI. Now, we test that:

1. a re-exported module doesn't cause a name clash with any data constructors
defined in the re-exporting module

2. a value, `a`, defined in a module, `A`, may be re-exported from another
module, `B`, and again re-exported from a third module, `C`, which imported `a`
from `B`.

* Have test module export data constructor in addition to re-export

I forgot to export the data constructor `A`. I had visually inspected the
generated code and saw that the names didn't conflict. However, it's better to
have the test make this assurance.
Latest commit c044d69 Jun 14, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Create issue templates (#3853) Apr 24, 2020
app Fix hlint warnings (#3864) May 8, 2020
bundle Fix making releases on Travis CI Apr 15, 2019
ci Setup `hlint` to run in the project (#3816) May 4, 2020
lib Printer for CST Modules (#3887) May 24, 2020
license-generator Split into packages (#3793) Mar 12, 2020
npm-package Bump versions for 0.13.6 (#3770) Jan 17, 2020
psc-ide Binary encoding for externs (#3841) Apr 12, 2020
src Have module re-exports appear in generated code (#3883) Jun 13, 2020
tests Have module re-exports appear in generated code (#3883) Jun 13, 2020
.gitignore Setup `hlint` to run in the project (#3816) May 4, 2020
.hlint.yaml Setup `hlint` to run in the project (#3816) May 4, 2020
.travis.yml Setup `hlint` to run in the project (#3816) May 4, 2020
CONTRIBUTING.md Error spans for CannotFindDerivingType (#3425) Sep 6, 2018
CONTRIBUTORS.md Have module re-exports appear in generated code (#3883) Jun 13, 2020
INSTALL.md Update INSTALL.md (#3607) May 8, 2019
LICENSE Run license-generator (#3771) Jan 17, 2020
Makefile Setup `hlint` to run in the project (#3816) May 4, 2020
README.md Final tweaks to ci/travis config Apr 14, 2019
RELEASE_GUIDE.md Remove core tests (#3861) May 8, 2020
Setup.hs Fix #624 - remove xdg-basedir dependency, simplify build. Oct 15, 2014
default-extensions.yaml Use the same default extensions everywhere (#3823) Mar 31, 2020
logo.png Revise readme Mar 20, 2015
make_release_notes Add release notes script Dec 16, 2015
package.yaml Updated purescript version in package.yaml (#3894) Jun 3, 2020
stack.yaml Binary encoding for externs (#3841) Apr 12, 2020

README.md

You can’t perform that action at this time.