fun tryParseExactMatcherConstructorOfOneArgument()

in intellij-feature-extractor/src/main/java/com/jetbrains/intellij/feature/extractor/extractor/FileTypeFactoryExtractor.kt [183:209]


    fun tryParseExactMatcherConstructorOfOneArgument(): String? {
      val oldPos = pos
      val new = instructions[pos++]
      if (new is TypeInsnNode && new.desc == EXACT_NAME_MATCHER) {
        if (instructions[pos++].opcode == DUP) {
          val argumentInsn = instructions[pos++]
          if (argumentInsn.opcode == Opcodes.LDC || argumentInsn.opcode == Opcodes.GETSTATIC) {
            val frame = frames[pos]
            val initInvoke = instructions[pos]
            pos++

            if (initInvoke is MethodInsnNode
              && initInvoke.name == "<init>"
              && initInvoke.owner == EXACT_NAME_MATCHER
              && initInvoke.desc == "(Ljava/lang/String;)V"
            ) {
              val string = CodeAnalysis().evaluateConstantString(method, frames, frame.getOnStack(0))
              if (string != null) {
                return string
              }
            }
          }
        }
      }
      pos = oldPos
      return null
    }