as-pect / visitor-as

Visitor utilities for AssemblyScript compiler transforms
Apache License 2.0
37 stars 11 forks source link

throw new AssertionError(message); #42

Closed mariusa closed 2 years ago

mariusa commented 2 years ago

Hi,

Trying to use with https://www.npmjs.com/package/json-as

FAILURE /my-project/node_modules/assemblyscript/std/portable/index.js:198
    throw new AssertionError(message);
          ^

AssertionError: assertion failed
    at null.Z.assert (/my-project/node_modules/assemblyscript/std/portable/index.js:198:11)
    at Transformer._visit (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/base.ts:336:9)
    at Transformer.visit (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/visitor.ts:34:12)
    at null.<anonymous> (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/visitor.ts:21:31)
    at Array.map (<anonymous>)
    at Transformer.visit (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/visitor.ts:21:12)
    at Transformer.visitBlockStatement (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/base.ts:533:10)
    at Transformer._visit (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/base.ts:194:14)
    at Transformer.visit (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/visitor.ts:34:12)
    at Transformer.visitFunctionDeclaration (/my-project/node_modules/@serial-as/transform/node_modules/visitor-as/src/base.ts:625:10

$ cat node_modules/visitor-as/package.json |grep ver
  "version": "0.11.3",
$ cat node_modules/assemblyscript/package.json |grep ver
  "version": "0.24.0",

Also with another package https://github.com/gagdiez/serial-as/issues/39

Thanks

mariusa commented 2 years ago

https://github.com/as-pect/visitor-as/blob/2b106ee8c9e4b8054ce2c65c73873aba10258aab/src/base.ts#L336

Why assert(false) instead of

console.error(`Unknown node kind ${node.kind}`)
mariusa commented 2 years ago

Found the root cause: https://github.com/AssemblyScript/assemblyscript/issues/2565