public override void Do() { var sym1 = GetQuestClassSymbol(link.Node1.Quest); var sym2 = GetQuestClassSymbol(link.Node2.Quest); var rewriter = new ComponentIsFinishedCallInInitializerRemover( sym2, sym1, Context.Code ); snapshot = Context.CodeEditor.ApplySyntaxRewriters(rewriter); Context.Flow.Graph.RemoveLink(link); }
public override void Do() { var sym2 = Context.CodeEditor.GetQuestClassSymbol(link.Node2.Quest); var rewriter = new ComponentIsFinishedCallAdder( link.Node1.Quest, sym2, Context.Code ); snapshot = Context.CodeEditor.ApplySyntaxRewriters(rewriter); Context.Flow.Graph.AddLink(link); CodeFixes.FixQuestInitializationOrder(link.Node2.Quest, Context); }
public override void Do() { snapshot = new CodeSnapshot(); var classDecls = codeBulk.Tree.GetRoot().DescendantNodes().OfType <ClassDeclarationSyntax>(); foreach (var classDecl in classDecls) { var typeRemover = new ClassConstructorCallRemover( Context.CodeEditor.GetSymbolFor(classDecl, codeBulk), Context.Code ); snapshot.Merge(Context.CodeEditor.ApplySyntaxRewriters(typeRemover)); } quest.Data.Ensure <ActivationData>().Sectors.Clear(); }
public override void Do() { var cb = Context.Code.SectorsAndCodeBulks[sector]; snapshot = new CodeSnapshot(); snapshot.PreviousCode[cb] = cb.Tree; var initializeMethod = cb.Tree .GetRoot() .DescendantNodes() .OfType<MethodDeclarationSyntax>() .First(m => m.Identifier.ValueText == "Initialize"); var body = initializeMethod.Body; var statementText = $"var {CodeEditor.FormatQuestNameForVar(quest.Name)} = new {CodeEditor.FormatQuestNameForClass(quest.Name)} {{}};\n"; var newInitializeMethod = initializeMethod.WithBody(body.AddStatements(SyntaxFactory.ParseStatement(statementText))); var newTree = cb.Tree.GetRoot().ReplaceNode(initializeMethod, newInitializeMethod).SyntaxTree; cb.Tree = newTree; var data = quest.Data.Ensure<ActivationData>(); data.Sectors.Add(sector); }
public override void Do() { snapshot = Context.CodeEditor.RemoveNode(action.Id, Context.Code.QuestsAndCodeBulks[quest]); data.Actions.RemoveAt(idx); }