From bf6752603895d6ff68a8d687080147495d025571 Mon Sep 17 00:00:00 2001
From: Niels <niels.bauquin@etu.univ-amu.fr>
Date: Mon, 12 Feb 2024 00:53:29 +0100
Subject: [PATCH] dfg

---
 src/ts/Ts.java              | 11 +++++++++++
 src/ts/TsItemVarSimple.java | 12 ++++++------
 src/ts/TsItemVarTab.java    | 12 ++++++------
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/ts/Ts.java b/src/ts/Ts.java
index d95fb75..770b95f 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 ae2a555..365db53 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 56c0a11..4d396af 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(){
-- 
GitLab