I tried to compile Fantom using bootstrap script (as described on http://fantom.org/doc/docTools/Bootstrap.html), but the result dev version of fantom was invalid. I've detected error with running fan examples/js/demo.fan and opening corresponding page in browser. So error was something like Uncaught TypeError: undefined is not a function in function fan.sys.Obj.$extend (really argument base was undefined).
Uncaught TypeError: undefined is not a function
Let me describe some investigation about this. Types are written to js file (e.g. to sys.js) in some order. I don't want to deep into details, but believe me, that this order depends on the order of file names returned by the java.io.File.list(). In my case for the source directory src/sys/fan/ this method returns the list of file names where file "Method.fan" is earlier than file "Func.fan". It leads to the TypeError error in JS (that was described above), because in the sys.js the line
fan.sys.MethodFunc = fan.sys.Obj.$extend(fan.sys.Func);
is earlier than
fan.sys.Func = fan.sys.Obj.$extend(fan.sys.Obj);
Promoted to ticket #1478 and assigned to andy
The order should be the same as the compiler uses - but someone had this issue as well - so will dig into.
Renamed from Invalid system pods after compiling Fantom to js: Invalid type order for sys pod
Ticket resolved in 1.0.66
I fixed two instances I found - there may be others - hard to find manually.
If you see another one - tack it on here (only for sys pod - lets use another ticket for other pods).
The issue as @jessevdam noted in #1612 - the class order is correct - but we use support classes that the Fantom compiler does not know about. So we need to be sure to implement those externally so we can write to sys.js lower to make sure we get dependencies out first.
Login or Signup to reply.