Skip to content

Commit

Permalink
feat(objectionary#329): fix small problems with CheckCast and ArrayCo…
Browse files Browse the repository at this point in the history
…nstructor types
  • Loading branch information
volodya-lombrozo committed Jul 10, 2024
1 parent b42815e commit 7a4d61b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/main/java/org/eolang/opeo/ast/ArrayConstructor.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.eolang.jeo.representation.xmir.XmlNode;
import org.eolang.opeo.compilation.Parser;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.xembly.Directive;
import org.xembly.Directives;

Expand All @@ -42,7 +43,7 @@
*/
@ToString
@EqualsAndHashCode
public final class ArrayConstructor implements AstNode {
public final class ArrayConstructor implements AstNode, Typed {

/**
* Array size.
Expand Down Expand Up @@ -94,4 +95,8 @@ public List<AstNode> opcodes() {
return res;
}

@Override
public Type type() {
return Type.getType(String.format("[L%s;", this.type));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public final class CheckCastHandler implements InstructionHandler {
public void handle(final DecompilerState state) {
final AstNode value = state.stack().pop();
final Object type = state.operand(0);
state.stack().push(new CheckCast((Type) type, value));
state.stack().push(new CheckCast(Type.getType((String) type), value));
}
}

0 comments on commit 7a4d61b

Please sign in to comment.