You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if you import a file that imports another file, only the first file will be included, this is functionality breaking behavior and needs to be fixed ASAP. Every import and from x import y statement should be expanded recursively until there are no more statements to expand.
I can easily see this leading to duplicate imports though, so that needs to be considered, it would be a shame if the 'minifier' tool ended up with exploding file sizes because of duplicate imports.
The text was updated successfully, but these errors were encountered:
This commit implements the relatively easier part of the recursive descent
compiler which is to just continually compile the given lines until there are no
more ksx statements.
This does choke however when two files create a circular reference. I have
added a recursion limit of 6 (which may actually be too low) to catch this
possible condition. Python actually chokes at some point too, but it takes a
while and I'd rather catch it sooner (also prefer giving a more friendly error
message).
I attempted to use a hash of the file contents to track whether we have already
compiled that file, but that is not working because the thing being hashed is
accumulating each compilation step, so it changes.
Anyways, recursion is hard, and this still needs some work, but it's usable
enough as long as you don't have any circular references.
Related to issue #7
Pushed a commit that partially implements this, but there is still some work to do. See acf0134 for details. In short, it basically works, but will die if there are circular imports, this should be good enough for simple cases though.
Currently, if you
import
a file thatimport
s another file, only the first file will be included, this is functionality breaking behavior and needs to be fixed ASAP. Everyimport
andfrom x import y
statement should be expanded recursively until there are no more statements to expand.I can easily see this leading to duplicate imports though, so that needs to be considered, it would be a shame if the 'minifier' tool ended up with exploding file sizes because of duplicate imports.
The text was updated successfully, but these errors were encountered: