Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix stackoverflow exception #10

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ public QObject defaultConvertToNumber(Runtime runtime) {
public QObject defaultAnd(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isBool())
return Val(value && ((QBool) other).value);
return super.and(runtime, other);
return super.defaultAnd(runtime, other);
}

@Override
public QObject defaultOr(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isBool())
return Val(value || other.boolValue());
return super.or(runtime, other);
return super.defaultOr(runtime, other);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,84 +63,84 @@ public QObject copy() {
public QObject defaultSum(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isList())
return Val(ListUtils.union(values, other.listValue()));
return super.sum(runtime, other);
return super.defaultSum(runtime, other);
}

@Override
public QObject defaultMultiply(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QListUtils.multiply(values, (int) other.numValue()));
return super.multiply(runtime, other);
return super.defaultMultiply(runtime, other);
}

@Override
public QObject defaultDivide(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QListUtils.divide(values, (int) other.numValue()));
return super.divide(runtime, other);
return super.defaultDivide(runtime, other);
}

@Override
public QObject defaultIntDivide(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QListUtils.intDivide(values, (int) other.numValue()));
return super.intDivide(runtime, other);
return super.defaultIntDivide(runtime, other);
}

@Override
public QObject defaultShiftLeft(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QListUtils.shift(values, (int) -other.numValue()));
return super.shiftLeft(runtime, other);
return super.defaultShiftLeft(runtime, other);
}

@Override
public QObject defaultShiftRight(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QListUtils.shift(values, (int) other.numValue()));
return super.shiftRight(runtime, other);
return super.defaultShiftRight(runtime, other);
}

@Override
public QObject defaultEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isList())
return Val(values.equals(other.listValue()));
return super.equalsObject(runtime, other);
return super.defaultEqualsObject(runtime, other);
}

@Override
public QObject defaultNotEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isList())
return Val(!values.equals(other.listValue()));
return super.notEqualsObject(runtime, other);
return super.defaultNotEqualsObject(runtime, other);
}

@Override
public QObject defaultGreater(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isList())
return Val(values.size() > other.listValue().size());
return super.greater(runtime, other);
return super.defaultGreater(runtime, other);
}

@Override
public QObject defaultGreaterEqual(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isList())
return Val(values.size() >= other.listValue().size());
return super.greaterEqual(runtime, other);
return super.defaultGreaterEqual(runtime, other);
}

@Override
public QObject defaultLess(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isList())
return Val(values.size() < other.listValue().size());
return super.less(runtime, other);
return super.defaultLess(runtime, other);
}

@Override
public QObject defaultLessEqual(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isList())
return Val(values.size() <= other.listValue().size());
return super.lessEqual(runtime, other);
return super.defaultLessEqual(runtime, other);
}

@Override
Expand All @@ -167,7 +167,7 @@ else if (index.numValue() < 0)
else
return values.get((int) index.numValue());
}
return super.index(runtime, index);
return super.defaultIndex(runtime, index);
}

@Override
Expand All @@ -181,7 +181,7 @@ else if (index.numValue() < 0)
values.set((int) index.numValue(), value);
return value;
}
return super.indexSet(runtime, index, value);
return super.defaultIndexSet(runtime, index, value);
}

@Override
Expand All @@ -192,7 +192,7 @@ else if (start.isNum() && end.isNull())
return Val(values.subList((int) start.numValue(), values.size()));
else if (start.isNull() && end.isNum())
return Val(values.subList(0, (int) end.numValue()));
return super.subscriptStartEnd(runtime, start, end);
return super.defaultSubscriptStartEnd(runtime, start, end);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public QObject copy() {
@Override
public QObject defaultEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNull()) return Val(true);
return super.equalsObject(runtime, other);
return super.defaultEqualsObject(runtime, other);
}

@Override
public QObject defaultNotEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNull()) return Val(false);
return super.notEqualsObject(runtime, other);
return super.defaultNotEqualsObject(runtime, other);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,105 +70,105 @@ public String toString() {
public QObject defaultSum(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value + ((QNumber) other).value);
return super.sum(runtime, other);
return super.defaultSum(runtime, other);
}

@Override
public QObject defaultSubtract(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value - ((QNumber) other).value);
return super.subtract(runtime, other);
return super.defaultSubtract(runtime, other);
}

@Override
public QObject defaultMultiply(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value * ((QNumber) other).value);
return super.multiply(runtime, other);
return super.defaultMultiply(runtime, other);
}

@Override
public QObject defaultDivide(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value / ((QNumber) other).value);
return super.divide(runtime, other);
return super.defaultDivide(runtime, other);
}

@Override
public QObject defaultIntDivide(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val((long) (value / ((QNumber) other).value));
return super.intDivide(runtime, other);
return super.defaultIntDivide(runtime, other);
}

@Override
public QObject defaultModulo(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value % ((QNumber) other).value);
return super.modulo(runtime, other);
return super.defaultModulo(runtime, other);
}

@Override
public QObject defaultPower(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(Math.pow(value, ((QNumber) other).value));
return super.power(runtime, other);
return super.defaultPower(runtime, other);
}

@Override
public QObject defaultShiftLeft(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value - ((QNumber) other).value);
return super.shiftLeft(runtime, other);
return super.defaultShiftLeft(runtime, other);
}

@Override
public QObject defaultShiftRight(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value + ((QNumber) other).value);
return super.shiftRight(runtime, other);
return super.defaultShiftRight(runtime, other);
}

@Override
public QObject defaultEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value == ((QNumber) other).value);
return super.equalsObject(runtime, other);
return super.defaultEqualsObject(runtime, other);
}

@Override
public QObject defaultNotEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value != ((QNumber) other).value);
return super.notEqualsObject(runtime, other);
return super.defaultNotEqualsObject(runtime, other);
}

@Override
public QObject defaultGreater(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value > ((QNumber) other).value);
return super.greater(runtime, other);
return super.defaultGreater(runtime, other);
}

@Override
public QObject defaultGreaterEqual(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value >= ((QNumber) other).value);
return super.greaterEqual(runtime, other);
return super.defaultGreaterEqual(runtime, other);
}

@Override
public QObject defaultLess(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value < ((QNumber) other).value);
return super.less(runtime, other);
return super.defaultLess(runtime, other);
}

@Override
public QObject defaultLessEqual(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return QObject.Val(value <= ((QNumber) other).value);
return super.lessEqual(runtime, other);
return super.defaultLessEqual(runtime, other);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,56 +75,56 @@ public QObject defaultSum(Runtime runtime, QObject other) {
public QObject defaultSubtract(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isStr())
return Val(value.replaceAll(Pattern.quote(other.toString()), ""));
return super.subtract(runtime, other);
return super.defaultSubtract(runtime, other);
}

@Override
public QObject defaultMultiply(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(StringUtils.repeat(value, (int) other.numValue()));
return super.multiply(runtime, other);
return super.defaultMultiply(runtime, other);
}

@Override
public QObject defaultDivide(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QStringUtils.divide(value, (int) other.numValue()));
return super.divide(runtime, other);
return super.defaultDivide(runtime, other);
}

@Override
public QObject defaultIntDivide(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QStringUtils.intDivide(value, (int) other.numValue()));
return super.intDivide(runtime, other);
return super.defaultIntDivide(runtime, other);
}

@Override
public QObject defaultShiftLeft(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QStringUtils.shift(value, (int) -other.numValue()));
return super.shiftLeft(runtime, other);
return super.defaultShiftLeft(runtime, other);
}

@Override
public QObject defaultShiftRight(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isNum())
return Val(QStringUtils.shift(value, (int) other.numValue()));
return super.shiftRight(runtime, other);
return super.defaultShiftRight(runtime, other);
}

@Override
public QObject defaultEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isStr())
return Val(value.equals(other.toString()));
return super.equalsObject(runtime, other);
return super.defaultEqualsObject(runtime, other);
}

@Override
public QObject defaultNotEqualsObject(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isStr())
return Val(!value.equals(other.toString()));
return super.equalsObject(runtime, other);
return super.defaultNotEqualsObject(runtime, other);
}

@Override
Expand All @@ -143,28 +143,28 @@ public QObject defaultNotContainsObject(Runtime runtime, QObject other) throws R
public QObject defaultGreater(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isStr())
return Val(value.length() > other.toString().length());
return super.greater(runtime, other);
return super.defaultGreater(runtime, other);
}

@Override
public QObject defaultGreaterEqual(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isStr())
return Val(value.length() >= other.toString().length());
return super.greaterEqual(runtime, other);
return super.defaultGreaterEqual(runtime, other);
}

@Override
public QObject defaultLess(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isStr())
return Val(value.length() < other.toString().length());
return super.less(runtime, other);
return super.defaultLess(runtime, other);
}

@Override
public QObject defaultLessEqual(Runtime runtime, QObject other) throws RuntimeStriker {
if (other.isStr())
return Val(value.length() <= other.toString().length());
return super.lessEqual(runtime, other);
return super.defaultLessEqual(runtime, other);
}

@Override
Expand Down
Loading
Loading