Assert code item is DexCode.

This is a follow-up of I3f09a22fa0d0eda6671f4c60d29b9363fb991df3.

Bug: 36799675, 36799092
Change-Id: I53d12b528043809f8ec0aa10c44fb7c7b95be862
diff --git a/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java b/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java
index 374f496..fe0ff72 100644
--- a/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/IdentifierMinifier.java
@@ -58,9 +58,10 @@
           return;
         }
         Code code = encodedMethod.getCode();
-        if (code == null || !code.isDexCode()) {
+        if (code == null) {
           return;
         }
+        assert code.isDexCode();
         DexCode dexCode = code.asDexCode();
         for (Instruction instr : dexCode.instructions) {
           if (instr instanceof ConstString) {
diff --git a/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java b/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java
index 38f8cb3..c10d0d7 100644
--- a/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java
+++ b/src/main/java/com/android/tools/r8/naming/SourceFileRewriter.java
@@ -47,15 +47,15 @@
           return;
         }
         Code code = encodedMethod.getCode();
-        // Other kinds of {@link Code} do not have debug_info_item.
-        if (code == null || !code.isDexCode()) {
+        if (code == null) {
           return;
         }
-        if (code.asDexCode().getDebugInfo() == null) {
+        assert code.isDexCode();
+        DexDebugInfo dexDebugInfo = code.asDexCode().getDebugInfo();
+        if (dexDebugInfo == null) {
           return;
         }
         // Thanks to a single global source file, we can safely remove DBG_SET_FILE entirely.
-        DexDebugInfo dexDebugInfo = code.asDexCode().getDebugInfo();
         dexDebugInfo.events =
             Arrays.stream(dexDebugInfo.events)
                 .filter(dexDebugEvent -> !(dexDebugEvent instanceof SetFile))