summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-12-29 17:28:46 +0330
committerAndreas Kling <kling@serenityos.org>2020-12-29 16:55:43 +0100
commit66b26fc1c24b38f78502c8cbcbc85d044a55797e (patch)
treee1fac723273dbdb500880af8e3c4d87c9e24b60a
parent5e5eb615ec1b7020548420afd7084f91674ace3d (diff)
downloadserenity-66b26fc1c24b38f78502c8cbcbc85d044a55797e.zip
Shell: Fix wrong step value for brace ranges
This fixes numeric ranges like {1..10}.
-rw-r--r--Shell/AST.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Shell/AST.cpp b/Shell/AST.cpp
index 2bd877624d..f599e74d97 100644
--- a/Shell/AST.cpp
+++ b/Shell/AST.cpp
@@ -1978,7 +1978,7 @@ RefPtr<Value> Range::run(RefPtr<Shell> shell)
if (start_int.has_value() && end_int.has_value()) {
auto start = start_int.value();
auto end = end_int.value();
- auto step = start > end ? 1 : -1;
+ auto step = start > end ? -1 : 1;
for (int value = start; value != end; value += step)
values.append(create<StringValue>(String::number(value)));
// Append the range end too, most shells treat this as inclusive.