Skip to content

Error with unary expression #4

Closed

Description

@tgfjt

Thank you for your gulp-unassert!

I'm not sure that unassert's responsible for this issue, but I record.

This is a minimum sample to occur the error.

function add (a, b) {
    !console.assert(a)
    return a + b;
}

Error:

/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:2421
        type = expr.type || Syntax.Property;
                   ^

TypeError: Cannot read property 'type' of null
    at CodeGenerator.generateExpression (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:2421:20)
    at CodeGenerator.Statement.ExpressionStatement (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:1321:28)
    at CodeGenerator.generateStatement (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:2440:33)
    at /Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:1078:51
    at withIndent (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:582:9)
    at CodeGenerator.Statement.BlockStatement (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:1028:13)
    at CodeGenerator.generateStatement (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:2440:33)
    at CodeGenerator.maybeBlock (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:837:33)
    at CodeGenerator.generateFunctionBody (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:955:30)
    at CodeGenerator.Statement.FunctionDeclaration (/Users/tgfjt/workspace/unassert-sample/node_modules/escodegen/escodegen.js:1733:22)

I got this error through JS includes jQuery.
e.g. https://github.com/jquery/jquery/blob/5c4be05d3b32456553dc944853b77fa96ae8b2b8/external/sizzle/dist/sizzle.js#L2155

Thanks!

Activity

  1. twada commented on Dec 8, 2015

    @twada
    Member

    @tgfjt Thank you for using unassert, thank you for reporting, and thank you for creating minimal reproduction case.

    Yes, this is a bug. I'll fix it ASAP.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions