diff --git a/src/ts/Ts.java b/src/ts/Ts.java index d95fb75ed1196eb28dbdeee9d450bbbe5f847082..770b95fb929f894e506bf2c7cf1e10774fd3e1aa 100644 --- a/src/ts/Ts.java +++ b/src/ts/Ts.java @@ -23,6 +23,11 @@ public class Ts public TsItemVar addVar(String identif, Type type) { + for (String id : variables.keySet()) { + if (id == identif && variables.get(id).isParam) { + return null; + } + } TsItemVar item = new TsItemVarSimple(identif, type); item.portee = this; item.adresse = this.adrVarCourante; @@ -34,6 +39,11 @@ public class Ts public TsItemVar addParam(String identif, Type type) { + for (String id : variables.keySet()) { + if (id == identif && variables.get(id).isParam) { + return null; + } + } TsItemVar item = new TsItemVarSimple(identif, type); item.portee = this; item.adresse = this.adrArgCourante; @@ -45,6 +55,7 @@ public class Ts public TsItemVar addTab(String identif, Type type, int taille) { + //Verifier qu'on est en global TsItemVar item = new TsItemVarTab(identif, type, taille); item.portee = this; item.adresse = this.adrVarCourante; diff --git a/src/ts/TsItemVarSimple.java b/src/ts/TsItemVarSimple.java index ae2a555a1149f34755bfb7a4ae4dde02a5345309..365db532c61fff1377d0abd359d98d388d5f9634 100644 --- a/src/ts/TsItemVarSimple.java +++ b/src/ts/TsItemVarSimple.java @@ -3,12 +3,12 @@ import util.Type; public class TsItemVarSimple extends TsItemVar{ public TsItemVarSimple(String identif, Type type){ - this.identif = identif; - this.adresse = 0; - this.portee = null; - this.taille = 1; - this.isParam = false; - this.type = type; + this.identif = identif; + this.adresse = 0; + this.portee = null; + this.taille = 1; + this.isParam = false; + this.type = type; } public String toString(){ diff --git a/src/ts/TsItemVarTab.java b/src/ts/TsItemVarTab.java index 56c0a116605fb11714826d27714c2aa3b046cc5c..4d396afccd3a66a115cd12d069c860a773b9244b 100644 --- a/src/ts/TsItemVarTab.java +++ b/src/ts/TsItemVarTab.java @@ -3,12 +3,12 @@ import util.Type; public class TsItemVarTab extends TsItemVar{ public TsItemVarTab(String identif, Type type, int taille){ - this.identif = identif; - this.adresse = 0; - this.portee = null; - this.taille = taille; - this.isParam = false; - this.type = type; + this.identif = identif; + this.adresse = 0; + this.portee = null; + this.taille = taille; + this.isParam = false; + this.type = type; } public String toString(){