public static InsnList returnValue ( Type returnType , InsnList returnValueInsnList ) { Validate . notNull ( returnType ) ; Validate . isTrue ( returnType . getSort ( ) != Type . METHOD ) ; InsnList ret = new InsnList ( ) ; ret . add ( returnValueInsnList ) ; switch ( returnType . getSort ( ) ) { case Type . VOID : ret . add ( new InsnNode ( Opcodes . RETURN ) ) ; break ; case Type . BOOLEAN : case Type . BYTE : case Type . SHORT : case Type . CHAR : case Type . INT : ret . add ( new InsnNode ( Opcodes . IRETURN ) ) ; break ; case Type . LONG : ret . add ( new InsnNode ( Opcodes . LRETURN ) ) ; break ; case Type . FLOAT : ret . add ( new InsnNode ( Opcodes . FRETURN ) ) ; break ; case Type . DOUBLE : ret . add ( new InsnNode ( Opcodes . DRETURN ) ) ; break ; case Type . OBJECT : case Type . ARRAY : ret . add ( new InsnNode ( Opcodes . ARETURN ) ) ; break ; default : throw new IllegalStateException ( ) ; } return ret ; }
Generates instructions that returns a value .