[ClavaAst] Adds ArraySubscriptExpr.getParentAccess()
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import org.suikasoft.jOptions.Interfaces.DataStore;
@@ -88,6 +89,14 @@ public class ArraySubscriptExpr extends Expr {
return subscripts;
}
+ public Optional<ArraySubscriptExpr> getParentAccess() {
+ var normalizedLhs = ClavaNodes.normalize(getLhs());
+
+ var parentAccess = normalizedLhs instanceof ArraySubscriptExpr ? (ArraySubscriptExpr) normalizedLhs : null;
+
+ return Optional.ofNullable(parentAccess);
+ }
+
/**
*
* @return true if this is a top-level array subscript
