public override void VisitNode(ITreeNode tNode)
            {
                var comment = FindInParent <IComment>(tNode);

                if (comment != null)
                {
                    Result = new CompletionTargetMarker {
                        HandlingNode = comment, Case = CompletionCase.Undefined
                    };
                    return;
                }

                // TODO think about this general handling
                //tNode = ChangeTargetFromWhitespaceAfterStmtToPrevLastChild(tNode);

                Result = FindHandlingNode(tNode);
                if (Result.Case == CompletionCase.Invalid)
                {
                    return;
                }

                var isSemicolon = CSharpTokenType.SEMICOLON == tNode.GetTokenType();

                if (isSemicolon)
                {
                    Result.Case = CompletionCase.EmptyCompletionAfter;
                }

                HandleTriggerInEmptyBody(tNode);
                HandleMissingCodeAtEndOfStmtLeadsToNewEmptyStmt(tNode);
                HandleOpeningBraceForYetUndefinedCases(tNode);
                HandleClosingBraceForExpressionsAndStatements(tNode);
                HandleTriggerInDeadAreaAfterClosingParenthesis(tNode);

                Result.HandlingNode = RENAME___SelectBetterNodesThanErrors(Result.HandlingNode);
                Result.HandlingNode = StepDownIntoMultiDeclarations(Result.HandlingNode);
                StepDownIntoExpressionStatements(tNode);
                HandleSwitchCases(tNode);

                HandleTriggerOnReferences(tNode);
                SetCaseForTriggerInTypeSignature(tNode);
                SetCaseForTriggerInMethodSignature(tNode);
                SetCaseForTriggerInLambdaSignature(tNode);
                SetCaseForTriggerInFieldAndEventSignatures(tNode);
                SetCaseForTriggerInNamespaceBody(tNode);
                SetCaseForTriggerInFileBody(tNode);
                SetCaseForTriggerInProperties(tNode);
                HandleTriggerInEmptyIfElseBlock(tNode);
                // try
                HandleTriggerInTryFinallyBlock(tNode);
                HandleTriggerAfterTryBlock(tNode);
                DetectTriggerInParametersOfCatchClause(tNode);
                HandleTriggerBetweenCatchBlocks(tNode);
                HandleEmptyCompletionAfterTryBlock(tNode);
                // assignments
                HandleTriggerInAssignments(tNode);
            }
Пример #2
0
 public TargetFinder()
 {
     Result = new CompletionTargetMarker();
 }