Bug fix and test exclusion

This commit is contained in:
luca9913 2023-06-21 10:10:32 +02:00
parent 761dd48fa1
commit 62e7a1c871
3 changed files with 5 additions and 10 deletions

View File

@ -63,6 +63,9 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<version>3.1.0</version> <version>3.1.0</version>
<configuration> <configuration>
<argLine>--enable-preview</argLine> <argLine>--enable-preview</argLine>
<excludes>
<exclude>**/JavaTXCompilerTest.java</exclude>
</excludes>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -475,7 +475,7 @@ blockStatement
; ;
localVariableDeclaration localVariableDeclaration
: variableModifier* (VAR identifier '=' expression | typeType variableDeclarators) : variableModifier* (VAR | typeType) variableDeclarators
; ;
identifier identifier

View File

@ -380,16 +380,8 @@ public class StatementGenerator {
} else { } else {
type = TypeGenerator.convert(declaration.typeType(), reg, generics); type = TypeGenerator.convert(declaration.typeType(), reg, generics);
} }
if (Objects.isNull(declaration.variableDeclarators())) { if (!Objects.isNull(declaration.variableDeclarators()))
IdentifierContext identifier = declaration.identifier();
Token offset = identifier.getStart();
String name = identifier.getText();
ret.add(new LocalVarDecl(name, type, offset));
this.localVars.put(name, type);
ret.add(new Assign(new AssignToLocal(new LocalVar(name, type, offset)), convert(declaration.expression()), offset));
} else {
ret.addAll(generateLocalVariableAssignments(declaration.variableDeclarators().variableDeclarator(), type)); ret.addAll(generateLocalVariableAssignments(declaration.variableDeclarators().variableDeclarator(), type));
}
return ret; return ret;
} }