Fix with hack bridge codegen for indexOf and lastIndexOf methods. More sophisticated solution is required.

This commit is contained in:
Ilya Gorbunov
2015-10-14 22:48:43 +03:00
parent 5017e54022
commit 935024db4e
2 changed files with 7 additions and 3 deletions
@@ -887,7 +887,11 @@ public class FunctionCodegen {
iv.ifne(afterBarrier);
StackValue.none().put(bridge.getReturnType(), iv);
String shortName = getFqName(descriptor).shortName().asString();
StackValue returnValue =
("indexOf".equals(shortName) || "lastIndexOf".equals(shortName)) ? StackValue.constant(-1, Type.INT_TYPE) : StackValue.none();
returnValue.put(bridge.getReturnType(), iv);
iv.areturn(bridge.getReturnType());
iv.visitLabel(afterBarrier);