Fixing AstBuilder For

pp script
This commit is contained in:
Purplumbi504 2024-07-04 23:41:04 +02:00
parent 64b15af6ef
commit e5dcbb8f99
4 changed files with 8 additions and 2 deletions

View File

@ -834,6 +834,12 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
* *
* @param ctx the dot subtraction expression context * @param ctx the dot subtraction expression context
* @return the AST node for the dot subtraction expression * @return the AST node for the dot subtraction expression
*//**
* Creates an ITypeNode based on the type identifier.
* It handles basic types and reference types.
*
* @param identifier the type identifier
* @return the type node
*/ */
@Override @Override
public ASTNode visitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) { public ASTNode visitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) {

View File

@ -633,7 +633,7 @@ class AstBuilderTest {
LocalVariableDeclarationNode forDeclaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "i", "=", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "0"))); LocalVariableDeclarationNode forDeclaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "i", "=", new UnaryNode(new ValueNode(EnumValueNode.INT_VALUE, "0")));
AssignableNode assignable = new AssignableNode("i"); AssignableNode assignable = new AssignableNode("i");
IncrementNode increment = new IncrementNode(CrementType.SUFFIX, assignable); IncrementNode increment = new IncrementNode(CrementType.PREFIX, assignable);
LocalVariableDeclarationNode declaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "a", null, null); LocalVariableDeclarationNode declaration = new LocalVariableDeclarationNode(new BaseType(TypeEnum.INT), "a", null, null);

View File

@ -1,7 +1,7 @@
class For{ class For{
public For(){ public For(){
for(int i = 0; i < 10; i++){ for(int i = 0; i < 10; ++i){
int a; int a;
} }
} }