JS: fix error in strict mode when NPE is never instantiated directly

This commit is contained in:
Alexey Andreev 2019-10-30 15:40:28 +03:00
parent 6bfbd38e22
commit 2bfc5b5305

View File

@ -290,6 +290,11 @@ public class JavaScriptTarget implements TeaVMTarget, TeaVMJavaScriptHost {
exceptionCons.getVariable(0).propagate(dependencyAnalyzer.getType(
ArrayIndexOutOfBoundsException.class.getName()));
exceptionCons.use();
exceptionCons = dependencyAnalyzer.linkMethod(new MethodReference(
NullPointerException.class, "<init>", void.class));
exceptionCons.getVariable(0).propagate(dependencyAnalyzer.getType(NullPointerException.class.getName()));
exceptionCons.use();
}
if (stackTraceIncluded) {