#889 compilerJs Rework

andy Tue 29 Dec 2009

Up until now, we've essentialy been using the prototype JavaScript compiler I hacked up last December ( #410) as a proof-of-concept. Over the course of the past year, I've bolted quite a bit onto the side, and the code had become pretty unmaintainable. So I slowly started reworking the compiler this past summer. I pushed the last and most complicated rework today. A number of fixes shook out of this rework:

  • Funcs now fully wrapped with fan.sys.Func
  • Full support for calling base ctors and this ctors
  • Support for += style operators
  • Cache Type lookups
  • Full sys pod type reflection
  • Fix sys\js\build to automate file dependencies
  • Flush out all Err classes
  • Duration: boot, uptime, toLocale, toIso, fromIso
  • Improve const/immutable support
  • Lists are now wrapped
  • Full support for ?: operator
  • Str: eachr, any, isAlpha, isAlphaNum
  • Full support for ?. and ?-> operators

Most of the work left should now just be in the sys libraries. We have enough of the runtime working now that we can start adding the normal testSys classes as a measure of what works and whats left to do. I haven't integrated JavaScript into fant yet - but you can manually run tests with:

C:\dev\fan\src>fan compilerJs::TestRunner
Fantom Test
Usage:
  fant [options] <pod>
  fant [options] <pod>::<test>
  fant [options] <pod>::<test>.<method>

And since line numbers don't really mean much - you can use the Dump utility to see the context of line numbers in errors:

C:\dev\fan\src>fan compilerJs::Dump
compilerJs Dump Utility
Usage:
  dump <pod> [line] [context]
Options:
  line     dump a specific line number
  context  number of lines to print around [line]; defaults to 4

Login or Signup to reply.