1 // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file 2 // for details. All rights reserved. Use of this source code is governed by a 3 // BSD-style license that can be found in the LICENSE file. 4 package com.android.tools.r8.ir.code; 5 6 import com.android.tools.r8.graph.DexMethod; 7 import java.util.List; 8 9 public abstract class InvokeMethodWithReceiver extends InvokeMethod { 10 11 private boolean isDominatedByCallWithSameReceiver = false; 12 InvokeMethodWithReceiver(DexMethod target, Value result, List<Value> arguments)13 InvokeMethodWithReceiver(DexMethod target, Value result, List<Value> arguments) { 14 super(target, result, arguments); 15 } 16 setIsDominatedByCallWithSameReceiver()17 public void setIsDominatedByCallWithSameReceiver() { 18 isDominatedByCallWithSameReceiver = true; 19 } 20 receiverIsNeverNull()21 public boolean receiverIsNeverNull() { 22 return isDominatedByCallWithSameReceiver || arguments().get(0).isNeverNull(); 23 } 24 25 @Override isInvokeMethodWithReceiver()26 public boolean isInvokeMethodWithReceiver() { 27 return true; 28 } 29 30 @Override asInvokeMethodWithReceiver()31 public InvokeMethodWithReceiver asInvokeMethodWithReceiver() { 32 return this; 33 } 34 } 35