fun tryKotlinLangObsoleteEndpoint()

in src/main/kotlin/com/compiler/server/controllers/KotlinPlaygroundRestController.kt [29:69]


  fun tryKotlinLangObsoleteEndpoint(
    @RequestParam type: String,
    @RequestParam(required = false) line: Int?,
    @RequestParam(required = false) ch: Int?,
    @RequestParam(required = false) project: Project?,
    @RequestParam(defaultValue = "false") addByteCode: Boolean,
  ): ResponseEntity<*> {
    val result = when (type) {
      "getKotlinVersions" -> listOf(kotlinProjectExecutor.getVersion())
      else -> {
        if (project == null) error("No parameter 'project' found")
        when (type) {
          "run" -> {
            when (project.confType) {
              ProjectType.JAVA -> kotlinProjectExecutor.run(project, addByteCode)
              ProjectType.JS -> throw LegacyJsException()
              ProjectType.JS_IR, ProjectType.CANVAS ->
                kotlinProjectExecutor.convertToJsIr(
                  project,
                )
              ProjectType.WASM, ProjectType.COMPOSE_WASM -> kotlinProjectExecutor.convertToWasm(
                project,
                debugInfo = false,
              )
              ProjectType.JUNIT -> kotlinProjectExecutor.test(project, addByteCode)
            }
          }

          "highlight" -> kotlinProjectExecutor.highlight(project)
          "complete" -> {
            if (line != null && ch != null) {
              kotlinProjectExecutor.complete(project, line, ch)
            } else error("No parameters 'line' or 'ch'")
          }

          else -> error("No parameter 'type' found")
        }
      }
    }
    return ResponseEntity.ok(result)
  }