Fix FieldAccessExpr's hasSideEffects() implementation

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 4 years ago
parent 919d9c2386
commit 8f0dfd2725
  1. 6
      deob-ast/src/main/java/dev/openrs2/deob/ast/util/ExprUtils.kt

@ -116,7 +116,7 @@ fun Expression.countNots(): Int {
} }
fun Expression.hasSideEffects(): Boolean { fun Expression.hasSideEffects(): Boolean {
if (isLiteralExpr || isNameExpr || isFieldAccessExpr || isThisExpr) { if (isLiteralExpr || isNameExpr || isThisExpr) {
return false return false
} else if (isUnaryExpr) { } else if (isUnaryExpr) {
return asUnaryExpr().expression.hasSideEffects() return asUnaryExpr().expression.hasSideEffects()
@ -126,7 +126,11 @@ fun Expression.hasSideEffects(): Boolean {
} else if (isArrayAccessExpr) { } else if (isArrayAccessExpr) {
val access = asArrayAccessExpr() val access = asArrayAccessExpr()
return access.name.hasSideEffects() || access.index.hasSideEffects() return access.name.hasSideEffects() || access.index.hasSideEffects()
} else if (isFieldAccessExpr) {
val access = asFieldAccessExpr()
return access.scope.hasSideEffects()
} }
// TODO(gpe): more cases // TODO(gpe): more cases
return true return true
} }

Loading…
Cancel
Save