Skip to content

Commit 34b592a

Browse files
committed
fix: fix eslint errors in KotlinArgs
1 parent df0cd0f commit 34b592a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/grammars/java.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ const { command } = GrammarUtils
1212

1313
const windows = GrammarUtils.OperatingSystem.isWindows()
1414

15-
const args = function (filepath, jar) {
16-
jar = (jar != null ? jar : path.basename(filepath)).replace(/\.kt$/, ".jar")
17-
const cmd = `kotlinc '${filepath}' -include-runtime -d ${jar} && java -jar ${jar}`
18-
return GrammarUtils.formatArgs(cmd)
19-
}
20-
2115
export const Java = {
2216
"File Based": {
2317
command,
@@ -37,19 +31,25 @@ export const Java = {
3731
},
3832
}
3933

34+
function KotlinArgs(filepath, jar) {
35+
const jarNew = (jar !== null ? jar : path.basename(filepath)).replace(/\.kt$/, ".jar")
36+
const cmd = `kotlinc '${filepath}' -include-runtime -d ${jarNew} && java -jar ${jarNew}`
37+
return GrammarUtils.formatArgs(cmd)
38+
}
39+
4040
export const Kotlin = {
4141
"Selection Based": {
4242
command,
4343
args(context) {
4444
const code = context.getCode()
4545
const tmpFile = GrammarUtils.createTempFileWithCode(code, ".kt")
46-
return args(tmpFile)
46+
return KotlinArgs(tmpFile, null)
4747
},
4848
},
4949
"File Based": {
5050
command,
5151
args({ filepath, filename }) {
52-
return args(filepath, `/tmp/${filename}`)
52+
return KotlinArgs(filepath, `/tmp/${filename}`)
5353
},
5454
},
5555
}

0 commit comments

Comments
 (0)