void AddExitTransition(ExitTransition exitTransition) {

            //==============================
            // Source Errors
            //==============================
            if(exitTransition.Source != null) {
                // Source in Exit Transition muss immer ein Task sein
                if (exitTransition.Source.Declaration == null) {
                    _diagnostics.Add(new Diagnostic(
                        exitTransition.Source.Location, 
                        DiagnosticDescriptors.Semantic.Nav0010CannotResolveTask0, 
                        exitTransition.Source.Name));

                } else {
                    var sourceNode = (TaskNodeSymbol) exitTransition.Source.Declaration;
                    sourceNode.Outgoings.Add(exitTransition);
                    sourceNode.References.Add(exitTransition.Source);
                }
            }

            //==============================
            // ConnectionPoint Errors
            //==============================
            if (exitTransition.ConnectionPoint != null) {

                if (exitTransition.ConnectionPoint.Declaration == null) {
                    _diagnostics.Add(new Diagnostic(
                        exitTransition.ConnectionPoint.Location,
                        DiagnosticDescriptors.Semantic.Nav0012CannotResolveExit0,
                        exitTransition.ConnectionPoint.Name));

                } else if(exitTransition.ConnectionPoint.Declaration.Kind !=ConnectionPointKind.Exit) {
                    _diagnostics.Add(new Diagnostic(
                        exitTransition.ConnectionPoint.Location,
                        DiagnosticDescriptors.Semantic.Nav0012CannotResolveExit0,
                        exitTransition.ConnectionPoint.Name));
                }
            }

            //==============================
            // Target Errors
            //==============================
            if (exitTransition.Target != null) {

                if (exitTransition.Target.Declaration == null) {
                    _diagnostics.Add(new Diagnostic(
                        exitTransition.Target.Location, 
                        DiagnosticDescriptors.Semantic.Nav0011CannotResolveNode0, 
                        exitTransition.Target.Name));

                } else if (exitTransition.Target.Declaration is InitNodeSymbol) {
                    _diagnostics.Add(new Diagnostic(
                        exitTransition.Target.Location,
                        DiagnosticDescriptors.Semantic.Nav0103InitNodeMustNotContainIncomingEdges));

                } else if (exitTransition.Target.Declaration is EndNodeSymbol) {
                    var node = (EndNodeSymbol)exitTransition.Target.Declaration;
                    node.Incomings.Add(exitTransition);
                    node.References.Add(exitTransition.Target);

                } else if (exitTransition.Target.Declaration is ExitNodeSymbol) {
                    var node = (ExitNodeSymbol)exitTransition.Target.Declaration;
                    node.Incomings.Add(exitTransition);
                    node.References.Add(exitTransition.Target);

                } else if (exitTransition.Target.Declaration is DialogNodeSymbol) {
                    var node = (DialogNodeSymbol)exitTransition.Target.Declaration;
                    node.Incomings.Add(exitTransition);
                    node.References.Add(exitTransition.Target);

                } else if (exitTransition.Target.Declaration is ViewNodeSymbol) {
                    var node = (ViewNodeSymbol)exitTransition.Target.Declaration;
                    node.Incomings.Add(exitTransition);
                    node.References.Add(exitTransition.Target);

                } else if (exitTransition.Target.Declaration is ChoiceNodeSymbol) {
                    var node = (ChoiceNodeSymbol)exitTransition.Target.Declaration;
                    node.Incomings.Add(exitTransition);
                    node.References.Add(exitTransition.Target);

                } else if (exitTransition.Target.Declaration is TaskNodeSymbol) {
                    var node = (TaskNodeSymbol)exitTransition.Target.Declaration;
                    node.Incomings.Add(exitTransition);
                    node.References.Add(exitTransition.Target);
                }
            }

            //==============================
            // Edge Errors
            //==============================
            if(exitTransition.EdgeMode != null) {
            }

            //==============================
            // Condition Clause Errors
            //==============================
            if (exitTransition.Syntax.ConditionClause != null) {
                
                if(!(exitTransition.Syntax.ConditionClause is IfConditionClauseSyntax)) {

                    _diagnostics.Add(new Diagnostic(
                               exitTransition.Syntax.ConditionClause.GetLocation(),
                               DiagnosticDescriptors.Semantic.Nav0221OnlyIfConditionsAllowedInExitTransitions));
                }
                
            }

            _taskDefinition.ExitTransitions.Add(exitTransition);
        }
        public override void VisitExitTransitionDefinition(ExitTransitionDefinitionSyntax exitTransitionDefinitionSyntax) {
            // Source
            ITaskNodeSymbol sourceTaskNodeSymbol = null;
            NodeReferenceSymbol sourceNodeReference = null;
            var sourceNodeSyntax = exitTransitionDefinitionSyntax.SourceNode;
            if (sourceNodeSyntax != null) {

                // Source in Exit Transition muss immer ein Task sein
                sourceTaskNodeSymbol = _taskDefinition.NodeDeclarations.TryFindSymbol(sourceNodeSyntax.Name) as ITaskNodeSymbol;
                var location         = sourceNodeSyntax.GetLocation();

                if (location != null) {
                    sourceNodeReference = new NodeReferenceSymbol(sourceNodeSyntax.Name, location, sourceTaskNodeSymbol);
                }
            }

            // ConnectionPoint
            ConnectionPointReferenceSymbol connectionPointReference = null;
            var exitIdentifier = exitTransitionDefinitionSyntax.ExitIdentifier;
            if (!exitIdentifier.IsMissing && sourceTaskNodeSymbol != null) {

                var exitIdentifierName  = exitIdentifier.ToString();
                var exitConnectionPoint = sourceTaskNodeSymbol.Declaration?.ConnectionPoints.TryFindSymbol(exitIdentifierName) as IExitConnectionPointSymbol;
                var location            = exitIdentifier.GetLocation();

                if (location != null) {
                    connectionPointReference = new ConnectionPointReferenceSymbol(exitIdentifierName, location, exitConnectionPoint);
                }
            }

            // Target
            NodeReferenceSymbol targetNodeReference = null;
            var targetNodeSyntax = exitTransitionDefinitionSyntax.TargetNode;
            if (targetNodeSyntax != null) {

                var targetNode = _taskDefinition.NodeDeclarations.TryFindSymbol(targetNodeSyntax.Name);
                var location   = targetNodeSyntax.GetLocation();

                if(location != null) {
                    targetNodeReference = new NodeReferenceSymbol(targetNodeSyntax.Name, location, targetNode);
                }
            }

            // Edge
            EdgeModeSymbol edgeMode = null;
            var edgeSyntax = exitTransitionDefinitionSyntax.Edge;
            if (edgeSyntax != null) {

                var location = edgeSyntax.GetLocation();

                if(location != null) {
                    edgeMode = new EdgeModeSymbol(edgeSyntax.ToString(), location, edgeSyntax.Mode);
                }
            }

            var exitTransition = new ExitTransition(exitTransitionDefinitionSyntax, _taskDefinition, sourceNodeReference, connectionPointReference, edgeMode, targetNodeReference);

            AddExitTransition(exitTransition);
        }