Skip to content
Snippets Groups Projects
Commit fcd2f19d authored by ZaynouneFatimaZahrae's avatar ZaynouneFatimaZahrae
Browse files

sa2ts

parent c636511c
No related branches found
No related tags found
No related merge requests found
......@@ -88,25 +88,23 @@ public class Sa2ts extends SaDepthFirstVisitor <Void> {
}
public Void visit(SaDecVarSimple node) {
boolean isGlobal = false;
public Void visit(SaVarSimple node) throws Exception {
defaultIn(node);
if (tableLocaleCourante.getVar(node.getNom()) != null){
if (tableGlobale.getVar(node.getNom()) != null) {
throw new RuntimeException("Erreur");
} else {
isGlobal = true;
if (tableLocaleCourante.getVar(node.getNom()).getTaille() != 1) throw new ErrorException(Error.TS,"Var not find");
node.tsItem = (TsItemVarSimple) tableLocaleCourante.getVar(node.getNom());
}
else if (tableGlobale.getVar(node.getNom()) != null){
if (tableGlobale.getVar(node.getNom()).getTaille() != 1) throw new ErrorException(Error.TS,"Var not find");
node.tsItem = (TsItemVarSimple) tableGlobale.getVar(node.getNom());
}
TsItemVar tsItemVar;
if(isGlobal){
tsItemVar = tableGlobale.getVar(node.getNom());
}else{
tsItemVar = tableLocaleCourante.getVar(node.getNom());
else {
throw new ErrorException(Error.TS,"Var not find");
}
node.tsItem = tsItemVar;
return null;
defaultOut(node);
return super.visit(node);
}
public Void visit(SaVarIndicee node) throws Exception {
defaultIn(node);
if(tableGlobale.getVar(node.getNom()) != null){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment