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

feat(#346): remove redundant if statements #429

Merged
Merged
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
14 changes: 1 addition & 13 deletions src/main/java/org/eolang/opeo/ast/StoreArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@
/**
* Store array element.
* @since 0.1
* @todo #329:90min Remove ad-hoc solution with storing array in a field.
* In the {@link StoreArray#opcodes()} I added ad-hoc solution to solve the problem with
* array elements storage if the array is a field.
* See the 'if' statement.
* This ad-hoc solution means we have architectural problem with array elements storage opcodes
* generation.
*/
public final class StoreArray implements AstNode, Typed {

Expand Down Expand Up @@ -111,13 +105,7 @@ public Iterable<Directive> toXmir() {
@Override
public List<AstNode> opcodes() {
final List<AstNode> res = new ArrayList<>(0);
if (this.array instanceof FieldRetrieval) {
res.addAll(this.array.opcodes());
} else if (this.array instanceof LocalVariable) {
res.addAll(this.array.opcodes());
} else {
res.addAll(this.array.opcodes());
}
res.addAll(this.array.opcodes());
res.addAll(this.index.opcodes());
res.addAll(this.value.opcodes());
res.add(new Opcode(Opcodes.AASTORE));
Expand Down