fun tryParseExactMatcherConstructorOfTwoArguments()

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


    fun tryParseExactMatcherConstructorOfTwoArguments(): 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) {
            if (instructions[pos].opcode == Opcodes.ICONST_0 || instructions[pos].opcode == Opcodes.ICONST_1) {
              pos++

              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;Z)V"
              ) {

                val string = CodeAnalysis().evaluateConstantString(method, frames, frame.getOnStack(1))
                if (string != null) {
                  return string
                }
              }
            }
          }
        }
      }
      pos = oldPos
      return null
    }