From 2ade8022437cc35e46c276e8d6be9e8114d12189 Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 16 Mar 2021 11:47:41 -0600 Subject: [PATCH] dist/bin/scalac -script args fix --- dist/bin/scalac | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dist/bin/scalac b/dist/bin/scalac index 74bfc4a603fe..7d56ac197cc5 100755 --- a/dist/bin/scalac +++ b/dist/bin/scalac @@ -79,7 +79,6 @@ classpathArgs () { jvm_cp_args="-classpath \"$toolchain\"" } -in_scripting_args=false while [[ $# -gt 0 ]]; do case "$1" in --) shift; for arg; do addResidual "$arg"; done; set -- ;; @@ -90,7 +89,8 @@ case "$1" in # Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222 -Oshort) addJava "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;; -repl) PROG_NAME="$ReplMain" && shift ;; - -script) PROG_NAME="$ScriptingMain" && target_script="$2" && in_scripting_args=true && shift && shift ;; + -script) PROG_NAME="$ScriptingMain" && target_script="$2" && shift && shift + while [[ $# -gt 0 ]]; do addScripting "$1" && shift ; done ;; -compile) PROG_NAME="$CompilerMain" && shift ;; -decompile) PROG_NAME="$DecompilerMain" && shift ;; -print-tasty) PROG_NAME="$DecompilerMain" && addScala "-print-tasty" && shift ;; @@ -104,13 +104,7 @@ case "$1" in # will be available as system properties. -D*) addJava "$1" && shift ;; -J*) addJava "${1:2}" && shift ;; - *) if [ $in_scripting_args == false ]; then - addResidual "$1" - else - addScripting "$1" - fi - shift - ;; + *) addResidual "$1" && shift ;; esac done