From 3086363267bc9b3dbc5043129ba8cdde259b9fc7 Mon Sep 17 00:00:00 2001 From: Niels <niels.bauquin@etu.univ-amu.fr> Date: Sun, 11 Feb 2024 15:57:26 +0100 Subject: [PATCH] dfg --- src/sa/Sc2sa.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/sa/Sc2sa.java b/src/sa/Sc2sa.java index 69385bb..90bdf60 100644 --- a/src/sa/Sc2sa.java +++ b/src/sa/Sc2sa.java @@ -144,7 +144,7 @@ public class Sc2sa extends DepthFirstAdapter op1 = (SaExp) this.returnValue; node.getExp4().apply(this); op2 = (SaExp) this.returnValue; - this.returnValue = new SaExpAdd(op1, op2); + this.returnValue = new SaExpSub(op1, op2); outASubExp3(node); } @@ -281,7 +281,7 @@ public class Sc2sa extends DepthFirstAdapter inAFairetantqueIns(node); SaExp test = null; SaInst faire = null; - node.getTantque().apply(this); + node.getExp().apply(this); test = (SaExp) this.returnValue; node.getBloc().apply(this); faire = (SaInst) this.returnValue; @@ -292,8 +292,11 @@ public class Sc2sa extends DepthFirstAdapter @Override public void caseAFonctionIns(AFonctionIns node) { inAFonctionIns(node); - node.getId().apply(this); - node.getGpar().apply(this); + String id = node.getId().getText(); + SaLExp args = null; + node.getLexp().apply(this); + args = (SaLExp) this.returnValue; + this.returnValue = new SaAppel(id, args); outAFonctionIns(node); } @@ -480,14 +483,14 @@ public class Sc2sa extends DepthFirstAdapter @Override public void caseATypeTypeopt(ATypeTypeopt node) { inATypeTypeopt(node); - this.returnType = Type.NUL; + if (node.getType() != null) {node.getType().apply(this);} outATypeTypeopt(node); } @Override public void caseAEpsilonTypeopt(AEpsilonTypeopt node) { inAEpsilonTypeopt(node); - this.returnValue = null; + this.returnType = Type.NUL; outAEpsilonTypeopt(node); } @@ -552,6 +555,7 @@ public class Sc2sa extends DepthFirstAdapter @Override public void caseAEpsilonLdecvar(AEpsilonLdecvar node) { inAEpsilonLdecvar(node); + this.returnValue = null; outAEpsilonLdecvar(node); } -- GitLab