Skip to content

Commit

Permalink
feat(objectionary#86): add one more puzzle
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jan 16, 2024
1 parent 9684c20 commit 58bd807
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/eolang/opeo/ast/InstanceField.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public Iterable<Directive> toXmir() {

@Override
public List<AstNode> opcodes() {
//@checkstyle MethodBodyCommentsCheck (10 lines)
// @todo #86:90min Implement "GETFIELD" opcode compilation from 'InstanceField'.
// The opcode should be compiled from the 'InstanceField' node correctly.
// Right now we put dummy owner and descriptor.
// Don't forget to remove this comment after the implementation is done and add new tests.
final List<AstNode> res = new ArrayList<>(0);
res.addAll(this.source.opcodes());
res.add(new Opcode(Opcodes.GETFIELD, "???owner???", this.name, "???descriptor???"));
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/org/eolang/opeo/ast/Literal.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ public List<AstNode> opcodes() {
} else if (this.object instanceof String) {
result = Collections.singletonList(Literal.opcode((String) this.object));
} else {
throw new UnsupportedOperationException("Not implemented yet");
throw new IllegalArgumentException(
String.format(
"Unsupported literal type %s, value is %s",
this.object.getClass().getName(),
this.object
)
);
}
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/eolang/opeo/ast/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ public Iterable<Directive> toXmir() {

@Override
public List<AstNode> opcodes() {
throw new UnsupportedOperationException("Not implemented yet");
return this.ref.get().opcodes();
}
}

0 comments on commit 58bd807

Please sign in to comment.