Bug description
Hi, I found that asc crashes while compiling the following AssemblyScript code snippet. I would expect a normal compilation error rather than a compiler crash.
Steps to reproduce
// bad.ts
namespace N {
abstract export class C {}
}
> node ~/assemblyscript/bin/asc --optimizeLevel 2 --shrinkLevel 2 bad.ts -o bad.wasm
Output:
▌ Whoops, the AssemblyScript compiler has crashed during initialize :-(
▌
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌
▌ AssertionError: assertion failed
▌ at Y.assert (~/assemblyscript/std/portable/index.js:216:11)
▌ at On.initializeNamespace (~/assemblyscript/src/program.ts:2813:18)
▌ at On.initialize (~/assemblyscript/src/program.ts:1144:18)
▌ at Module.MS (~/assemblyscript/src/index-wasm.ts:354:11)
▌ at Module.De (~/assemblyscript/cli/index.js:714:22)
▌ at async file:///~/assemblyscript/bin/asc.js:33:22
Other findings
- The valid modifier order inside a namespace does not crash:
namespace N {
export abstract class C {}
}
- The same invalid modifier order at the top level reports a normal compilation error instead of crashing:
// good.ts
abstract export class C {}
// ~/warpo/build/warpo/warpo_asc --optimizeLevel 2 --shrinkLevel 2 good.ts -o mutant.wasm
// compilation failed
// ERROR TS2304: Cannot find name 'abstract'.
// :
// 2 │ abstract export class C{}
// │ ~~~~~~~~
// └─ in good.ts(2,1)
// ERROR: compilation failed
AssemblyScript version
b6bda05
Bug description
Hi, I found that
asccrashes while compiling the following AssemblyScript code snippet. I would expect a normal compilation error rather than a compiler crash.Steps to reproduce
Other findings
AssemblyScript version
b6bda05