Skip to content

Commit

Permalink
<fix>(v2,v3): fix static struct static array bug. (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay authored Feb 29, 2024
1 parent 1f13f82 commit 9cc1b17
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ext {
commonsLang3Version = '3.12.0'

javaSDKVersion3 = "3.6.0"
javaSDKVersion2 = "2.9.1"
javaSDKVersion2 = "2.10.0-SNAPSHOT"
slf4jVersion = "1.7.32"
}

Expand All @@ -50,7 +50,7 @@ sourceSets {
// integrationTest.mustRunAfter test
allprojects {
group = 'org.fisco-bcos.code-generator'
version = '1.3.0'
version = '1.4.0-SNAPSHOT'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'eclipse'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,11 @@ private List<TypeSpec> buildStructTypes(List<ABIDefinition> functionDefinitions)
if (namedType.getType().equals("tuple[]") && internalType.endsWith("[]")) {
internalType = internalType.substring(0, internalType.lastIndexOf("["));
}
if (namedType.getType().matches("tuple\\[\\d+\\]")
&& internalType.endsWith("]")
&& internalType.matches(".*\\[\\d+\\]")) {
internalType = internalType.substring(0, internalType.lastIndexOf("["));
}
if (internalType.contains(".")) {
structName = internalType.substring(internalType.lastIndexOf(".") + 1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ private List<TypeSpec> buildStructTypes(List<ABIDefinition> functionDefinitions)
if (namedType.getType().equals("tuple[]") && internalType.endsWith("[]")) {
internalType = internalType.substring(0, internalType.lastIndexOf("["));
}
if (namedType.getType().matches("tuple\\[\\d+\\]")
&& internalType.endsWith("]")
&& internalType.matches(".*\\[\\d+\\]")) {
internalType = internalType.substring(0, internalType.lastIndexOf("["));
}
if (isWasm) {
structName = internalType.substring(internalType.lastIndexOf(".") + 1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ public void complexABICodeGen() throws IOException {
codeGenTest(COMPLEX_ABI_FILE, COMPLEX_NAME);
}

@Test
public void complexABICodeGen2() throws IOException {
final String COMPLEX_ABI_FILE = "ComplexCodecTest2.abi";
final String COMPLEX_NAME = "ComplexCodecTest";
codeGenTest(COMPLEX_ABI_FILE, COMPLEX_NAME);
}

@Test
public void tableABICodeGen() throws IOException {
final String ABI_FILE = "Table.abi";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ public void complexABICodeGen() throws IOException {
codeGenTest(COMPLEX_ABI_FILE, COMPLEX_NAME);
}

@Test
public void complexABICodeGen2() throws IOException {
final String COMPLEX_ABI_FILE = "ComplexCodecTest2.abi";
final String COMPLEX_NAME = "ComplexCodecTest";
codeGenTest(COMPLEX_ABI_FILE, COMPLEX_NAME);
}

@Test
public void tableABICodeGen() throws IOException {
final String ABI_FILE = "Table.abi";
Expand Down
Loading

0 comments on commit 9cc1b17

Please sign in to comment.