public void Refuse_If_AST_Has_Errors_Reported() { NotificationManager manager = new NotificationManager(); Assert.IsTrue(manager.GetNotifications().Count == 0); manager.AddNotification(new DummyError()); var x = MainTypeChecker.GetTypeCheckDiagnosis(new ASTResult(null, manager)); Assert.IsTrue(x.NotificationManager.GetNotifications().Count == manager.GetNotifications().Count); }
private INotificationManager Has_Duplicate_Identifiers(Form node) { List<Id> definedIdList = GetDefinedIdList(node); INotificationManager notificationManager = new NotificationManager(); foreach (Id id in definedIdList.GroupBy(s => s.Name).SelectMany(grp => grp.Skip(1))) { notificationManager.AddNotification(new DuplicateIdentifier(id.Name, id.GetPosition())); } return notificationManager; }
private INotificationManager Has_Undefined_Identifiers(Form node) { List<Id> definedIdList = GetDefinedIdList(node); List<Id> usedIdList = new List<Id>(); INotificationManager notificationManager = new NotificationManager(); foreach (FormObject formObject in node.GetBody()) { usedIdList.AddRange(formObject.Accept(new UsedIdentifierCollector())); } notificationManager.AddNotifications( usedIdList.FindAll(id => !definedIdList.Contains(id)) .Select(id => new UndefinedIdentifier(id.GetPosition(),id.Name) )); return notificationManager; }
public static ASTResult GetTypeCheckDiagnosis(ASTResult astResult) { //Precondition: no previous errors if (astResult.HasError()) // if it already has errors, refuse to add more return astResult; Form rootNode = astResult.RootNode; INotificationManager manager = new NotificationManager(); manager.Combine(new IdentifierChecker(manager).AnalyzeAndReport(rootNode)); manager.Combine(new ExpressionContainerChecker(manager, GetIdentifierTypes(rootNode)) .AnalyzeAndReport(rootNode.GetBody()) ); manager.Combine(new CyclicDependencyChecker(manager).AnalyzeAndReport(rootNode.GetBody())); manager.Combine(new LabelChecker().AnalyzeAndReport(rootNode.GetBody())); astResult.CombineNotifications(manager); return astResult; }
/// <summary> /// Login function /// </summary> void client_ClientLoginCompleted(object sender, ClientLoginCompletedEventArgs e) { if (e.Result != null) { //MessageBox.Show("Successfully Loged in"); LoginBlock.Visibility = System.Windows.Visibility.Collapsed; blackBG.Visibility = System.Windows.Visibility.Collapsed; profFName.Text = e.Result.FirstName; profLName.Text = e.Result.LastName; profEMail.Text = e.Result.Email; profUName.Text = e.Result.Username; profDOB.Text = e.Result.Age.ToString(); //Saving user password if checkbox checked username = e.Result.Username; password = passBox.Password; if (savePass.IsChecked == true) { IsolatedStorageSettings.ApplicationSettings["Username"] = username; IsolatedStorageSettings.ApplicationSettings["Password"] = password; } client.CheckFriendshipsStatusAsync(username); client.GetFriendsListAsync(username); NotificationManager manager = new NotificationManager(); manager.Username = e.Result.Username; manager.SetupNotificationChannel(); } else { MessageBox.Show("Incorrect Login or Password"); blackBG.Visibility = System.Windows.Visibility.Visible; ShowHideLoginBlock(true); } }
public ParserErrorListener() { NotificationManager = new NotificationManager(); }