af45bfd53f
* Improve some logging and assertions. * Initialize the prototype map (it was always empty before). * Actually memoize the prototype objects in this map. * During class initialization, ensure the base class is also initialized. * Trigger class initialization anytime a property or function is loaded from that class. Similarly, trigger module initialization on loads too. * Treat For/ForIn/ForOfStatements as legal parents for local variables. This ensures for loops at the top-level in a module have their variables treated as locals, rather than module properties. Add a test also. * Track source locations for more nodes. * Mark auto-generated constructors as public so that they may be called. * Fix the naming of class init methods; it should be ".init", not ".ctor". * Clone the loop test cases into both function and module top-level variants. |
||
---|---|---|
.. | ||
cmd | ||
lib | ||
tests | ||
.gitignore | ||
mujs | ||
package.json | ||
README.md | ||
tsconfig.json | ||
tslint.json | ||
yarn.lock |
MuJS
This directory contains Mu's JavaScript compiler.
It implements a subset of JavaScript with TypeScript-style type annotations, and can compile that subset into MuPack/IL.
Building and Testing
MuJS is built independent from the overall Mu toolchain. First clone and cd to the right place:
$ git clone git@github.com:marapongo/mu
$ cd mu/tools/mujs
Next, install dependencies, ideally using Yarn:
$ yarn install
(NPM can be used instead, but Yarn offers better performance, reliability, and security, so it's what we use below.)
From there, to build:
$ yarn run build
It's possible to simply run the TypeScript compiler using tsc
, however the Yarn build step performs a couple extra
steps; namely, it runs TSLint and also copies some test baseline files into the right place.
Next, to test, simply run:
$ yarn run test
It will be obvious if the tests passed or failed and, afterwards, code coverage data will be output to the console.
Libraries
In order to use the Mu libraries -- including the Mu standard library -- you will need to do a few additional steps to prepare your developer workspace. Please see this document for details on how to do this.