Added safe checking

This commit is contained in:
Lukasz Baldyga committed 2020-11-27 15:16:03 +00:00
1 parent 6f9083ab6f
commit 3a979f8faa
1 file changed
+3 -2
@@ -22,10 +22,11 @@ namespace Advanced_Software_Engineering.Verbs.Value {
//Seperate the assignment from the variables //Seperate the assignment from the variables
List<string> assignmentList = SettingsAndHelperFunctions.StripStringArray(assignment.Split("="[0])); List<string> assignmentList = SettingsAndHelperFunctions.StripStringArray(assignment.Split("="[0]));
name = assignmentList[0]; name = assignmentList[0];
if (drawer.CheckVariableExists(name)) throw new Exception("Declaration failed. " + name + " has been declared before");
value = ValueFactory.CreateValue(assignmentList[1], type); value = ValueFactory.CreateValue(assignmentList[1], type);
} else { } else {
throw new NotImplementedException(); //boolean here
throw new NotImplementedException("Booleans cannot be parsed yet");
} }
} }