package kotlin.reflect.jvm.internal.impl.incremental;

import com.google.android.gms.measurement.api.AppMeasurementSdk;
import defpackage.cr4;
import defpackage.kp6;
import kotlin.reflect.jvm.internal.impl.descriptors.ClassDescriptor;
import kotlin.reflect.jvm.internal.impl.descriptors.PackageFragmentDescriptor;
import kotlin.reflect.jvm.internal.impl.incremental.components.LocationInfo;
import kotlin.reflect.jvm.internal.impl.incremental.components.LookupLocation;
import kotlin.reflect.jvm.internal.impl.incremental.components.LookupTracker;
import kotlin.reflect.jvm.internal.impl.incremental.components.Position;
import kotlin.reflect.jvm.internal.impl.incremental.components.ScopeKind;
import kotlin.reflect.jvm.internal.impl.name.Name;
import kotlin.reflect.jvm.internal.impl.resolve.DescriptorUtils;

/* JADX INFO: loaded from: classes3.dex */
public final class UtilsKt {
    public static final void record(@kp6 LookupTracker lookupTracker, @kp6 LookupLocation lookupLocation, @kp6 ClassDescriptor classDescriptor, @kp6 Name name) {
        LocationInfo location;
        cr4.g(lookupTracker, "<this>");
        cr4.g(lookupLocation, "from");
        cr4.g(classDescriptor, "scopeOwner");
        cr4.g(name, AppMeasurementSdk.ConditionalUserProperty.NAME);
        if (lookupTracker == LookupTracker.DO_NOTHING.INSTANCE || (location = lookupLocation.getLocation()) == null) {
            return;
        }
        Position position = lookupTracker.getRequiresPosition() ? location.getPosition() : Position.Companion.getNO_POSITION();
        String filePath = location.getFilePath();
        String strAsString = DescriptorUtils.getFqName(classDescriptor).asString();
        ScopeKind scopeKind = ScopeKind.CLASSIFIER;
        String strAsString2 = name.asString();
        cr4.f(strAsString2, "asString(...)");
        lookupTracker.record(filePath, position, strAsString, scopeKind, strAsString2);
    }

    public static final void recordPackageLookup(@kp6 LookupTracker lookupTracker, @kp6 LookupLocation lookupLocation, @kp6 String str, @kp6 String str2) {
        LocationInfo location;
        cr4.g(lookupTracker, "<this>");
        cr4.g(lookupLocation, "from");
        cr4.g(str, "packageFqName");
        cr4.g(str2, AppMeasurementSdk.ConditionalUserProperty.NAME);
        if (lookupTracker == LookupTracker.DO_NOTHING.INSTANCE || (location = lookupLocation.getLocation()) == null) {
            return;
        }
        lookupTracker.record(location.getFilePath(), lookupTracker.getRequiresPosition() ? location.getPosition() : Position.Companion.getNO_POSITION(), str, ScopeKind.PACKAGE, str2);
    }

    public static final void record(@kp6 LookupTracker lookupTracker, @kp6 LookupLocation lookupLocation, @kp6 PackageFragmentDescriptor packageFragmentDescriptor, @kp6 Name name) {
        cr4.g(lookupTracker, "<this>");
        cr4.g(lookupLocation, "from");
        cr4.g(packageFragmentDescriptor, "scopeOwner");
        cr4.g(name, AppMeasurementSdk.ConditionalUserProperty.NAME);
        String strAsString = packageFragmentDescriptor.getFqName().asString();
        String strAsString2 = name.asString();
        cr4.f(strAsString2, "asString(...)");
        recordPackageLookup(lookupTracker, lookupLocation, strAsString, strAsString2);
    }
}
