Skip to content

Error when minifying code #8

Open

Description

@2dengine

Hello and thank you for sharing your library.
The minification feature is very useful, but it fails when trying to process the following file:

https://github.com/Egor-Skriptunoff/pure_lua_SHA/blob/master/sha2.lua

Error: utils/maker/minify.lua:4509: Bad argument #1 to 'traverseTree'. (Expected table, got nil)

Activity

  1. changed the title [-]Error when minifying FFI code[/-] [+]Error when minifying code[/+] on Jan 12, 2025
  2. NekOware commented on May 16, 2025

    @NekOware

    I may be a little late to reply to this, but I still hope to be helpful.
    The error message you provided is caused by passing nil to the minify, optimize or simplify functions which isn't super helpful, but with the file you provided I found the solution to your problem.
    You're not properly looking at the return values of the parse function which upon an error returns nil, error_string instead of the astNode you're expecting.

    As for the parser error, it's caused by following a ^ character with a negative literal number and can be fixed by encapsulating the negative number within parentheses.
    In the file you provided this error happens at lines 4266 and 4273.

    This problem is also mentioned in issue#5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions