Fixed a casting bug in Painless.
This commit is contained in:
parent
1d394868d4
commit
95a1b5b2a3
|
@ -233,6 +233,7 @@ public final class EChain extends AExpression {
|
|||
if (last instanceof ADefLink) {
|
||||
final ADefLink lastDef = (ADefLink) last;
|
||||
expression.analyze(settings, definition, variables);
|
||||
// TODO: does it make more sense to just re-use last.after instead of using storeValueType?
|
||||
lastDef.storeValueType = expression.expected = expression.actual;
|
||||
this.actual = read ? lastDef.storeValueType : definition.voidType;
|
||||
} else {
|
||||
|
@ -316,7 +317,12 @@ public final class EChain extends AExpression {
|
|||
expression.write(settings, definition, adapter);
|
||||
|
||||
if (link.load) {
|
||||
WriterUtility.writeDup(adapter, link.after.sort.size, link.size);
|
||||
// storeValueType may be different from after, so use storeValueType if last is an ADefLink
|
||||
if (last instanceof ADefLink) {
|
||||
WriterUtility.writeDup(adapter, ((ADefLink)last).storeValueType.sort.size, link.size);
|
||||
} else {
|
||||
WriterUtility.writeDup(adapter, link.after.sort.size, link.size);
|
||||
}
|
||||
}
|
||||
|
||||
link.store(settings, definition, adapter);
|
||||
|
|
|
@ -41,7 +41,6 @@ final class LDefArray extends ADefLink {
|
|||
this.index = index;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
ALink analyze(final CompilerSettings settings, final Definition definition, final Variables variables) {
|
||||
index.analyze(settings, definition, variables);
|
||||
|
@ -69,6 +68,7 @@ final class LDefArray extends ADefLink {
|
|||
if (storeValueType == null) {
|
||||
throw new IllegalStateException(error("Illegal tree structure."));
|
||||
}
|
||||
|
||||
final String desc = Type.getMethodDescriptor(definition.voidType.type, definition.defType.type,
|
||||
index.actual.type, storeValueType.type);
|
||||
adapter.invokeDynamic("arrayStore", desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.ARRAY_STORE);
|
||||
|
|
Loading…
Reference in New Issue