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>
<configuration>
<argLine>--enable-preview</argLine>
<excludes>
<exclude>**/JavaTXCompilerTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>

View File

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

View File

@ -380,16 +380,8 @@ public class StatementGenerator {
} else {
type = TypeGenerator.convert(declaration.typeType(), reg, generics);
}
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 {
if (!Objects.isNull(declaration.variableDeclarators()))
ret.addAll(generateLocalVariableAssignments(declaration.variableDeclarators().variableDeclarator(), type));
}
return ret;
}