File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -114,13 +114,18 @@ namespace FPL {
114
114
if (PossibleVariable.has_value ()) {
115
115
if (isVariable (PossibleVariable->mText )) {
116
116
if (CheckerOperateur (" ;" ).has_value ()) {
117
- VariableDefinition variable;
118
- variable.VariableName = VarName->mText ;
119
- variable.VariableType = Type (VarType->mName , VarType->mType );
120
- variable.VariableValue = mVariables [PossibleVariable->mText ].VariableValue ;
121
-
122
- mVariables [variable.VariableName ] = variable;
123
- return true ;
117
+ auto OldVariable = mVariables [PossibleVariable->mText ];
118
+ if (OldVariable.VariableType .mType == VarType->mType ) {
119
+ VariableDefinition variable;
120
+ variable.VariableName = VarName->mText ;
121
+ variable.VariableType = Type (VarType->mName , VarType->mType );
122
+ variable.VariableValue = OldVariable.VariableValue ;
123
+
124
+ mVariables [variable.VariableName ] = variable;
125
+ return true ;
126
+ } else {
127
+ std::cerr << " Vous devez donner une valeur a la variable qui correspond au type." << std::endl;
128
+ }
124
129
} else {
125
130
std::cerr << " Merci de signifier la fin de la déclaration de la variable avec '|'." << std::endl;
126
131
}
You can’t perform that action at this time.
0 commit comments