Skip to content

Commit

Permalink
Issue-1216: wrong method signature for multidimensional arrays
Browse files Browse the repository at this point in the history
- review changes
  • Loading branch information
Maximilian Schmidt committed Oct 26, 2018
1 parent 0790224 commit 24012e4
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,23 @@ public byte[] encode(Object value) {
throw new RuntimeException("List value expected for type " + getName());
}
}

@Override
public String getCanonicalName() {
return getArrayCanonicalName("");
}

String getArrayCanonicalName(String parentDimStr) {
String myDimStr = parentDimStr + getCanonicalDimension();
if (getElementType() instanceof ArrayType) {
return ((ArrayType) getElementType()).
getArrayCanonicalName(myDimStr);
} else {
return getElementType().getCanonicalName() + myDimStr;
}
}

protected abstract String getCanonicalDimension();

public SolidityType getElementType() {
return elementType;
Expand Down Expand Up @@ -164,6 +181,11 @@ public String getCanonicalName() {
return elementType.getCanonicalName() + "[" + size + "]";
}
}

@Override
protected String getCanonicalDimension() {
return "[" + size + "]";
}

@Override
public byte[] encodeList(List l) {
Expand Down Expand Up @@ -207,6 +229,11 @@ public String getCanonicalName() {
return elementType.getCanonicalName() + "[]";
}
}

@Override
protected String getCanonicalDimension() {
return "[]";
}

@Override
public byte[] encodeList(List l) {
Expand Down

0 comments on commit 24012e4

Please sign in to comment.