Example usage for org.objectweb.asm.commons InstructionAdapter ifnonnull

List of usage examples for org.objectweb.asm.commons InstructionAdapter ifnonnull

Introduction

In this page you can find the example usage for org.objectweb.asm.commons InstructionAdapter ifnonnull.

Prototype

public void ifnonnull(final Label label) 

Source Link

Usage

From source file:org.jetbrains.jet.codegen.intrinsics.Sure.java

License:Apache License

@Override
public StackValue generate(ExpressionCodegen codegen, InstructionAdapter v, Type expectedType,
        PsiElement element, List<JetExpression> arguments, StackValue receiver) {
    JetCallExpression call = (JetCallExpression) element;
    ResolvedCall<? extends CallableDescriptor> resolvedCall = codegen.getBindingContext()
            .get(BindingContext.RESOLVED_CALL, call.getCalleeExpression());
    assert resolvedCall != null;
    if (resolvedCall.getReceiverArgument().getType().isNullable()) {
        receiver.put(receiver.type, v);//from www .j  a  va2 s.  c o m
        v.dup();
        Label ok = new Label();
        v.ifnonnull(ok);
        v.invokestatic("jet/runtime/Intrinsics", "throwNpe", "()V");
        v.mark(ok);
        StackValue.onStack(receiver.type).put(expectedType, v);
    } else {
        codegen.generateFromResolvedCall(resolvedCall.getReceiverArgument(), expectedType);
    }
    return StackValue.onStack(expectedType);
}