예제 #1
0
        protected internal Init(NRefactory.VariableInitializer variableInitializer, IScope scope, INRefcatoryExpressionVisitor visitor)
            : base(scope, visitor) {
            NRefactory.Expression initializer = null;

            _variableInitializer = variableInitializer;
            initializer = variableInitializer.Initializer;
        }
예제 #2
0
        public override void VisitVariableInitializer(VariableInitializer variableInitializer)
        {
            if (!variableInitializer.AssignToken.IsNull)
            {
                ForceSpacesAround(variableInitializer.AssignToken, policy.SpaceAroundAssignment);
            }
            if (!variableInitializer.Initializer.IsNull)
            {
                int extraSpaces    = 0;
                var useExtraSpaces = variableInitializer.AssignToken.StartLocation.Line == variableInitializer.Initializer.StartLocation.Line;
                if (useExtraSpaces)
                {
                    extraSpaces            = Math.Max(0, variableInitializer.AssignToken.StartLocation.Column + 1 - curIndent.IndentString.Length);
                    curIndent.ExtraSpaces += extraSpaces;
                }
                else
                {
                    curIndent.Push(IndentType.Continuation);
                    FixIndentation(variableInitializer.Initializer);
                }
                variableInitializer.Initializer.AcceptVisitor(this);

                if (useExtraSpaces)
                {
                    curIndent.ExtraSpaces -= extraSpaces;
                }
                else
                {
                    curIndent.Pop();
                }
            }
        }
예제 #3
0
        protected internal Init(NRefactory.VariableInitializer variableInitializer, IScope scope, INRefcatoryExpressionVisitor visitor)
            : base(scope, visitor)
        {
            NRefactory.Expression initializer = null;

            _variableInitializer = variableInitializer;
            initializer          = variableInitializer.Initializer;
        }
예제 #4
0
        S IAstVisitor <T, S> .VisitVariableInitializer(VariableInitializer variableInitializer, T data)
        {
            var handler = VariableInitializerVisited;

            if (handler != null)
            {
                handler(variableInitializer, data);
            }
            return(VisitChildren(variableInitializer, data));
        }
예제 #5
0
 public override void VisitVariableInitializer(VariableInitializer variableInitializer)
 {
     if (!variableInitializer.AssignToken.IsNull)
     {
         ForceSpacesAround(variableInitializer.AssignToken, policy.SpaceAroundAssignment);
     }
     if (!variableInitializer.Initializer.IsNull)
     {
         variableInitializer.Initializer.AcceptVisitor(this);
     }
 }
        private static List <AstNode> ComputeMatchNodes(RefactoringContext context, VariableInitializer firstOrNullObject)
        {
            var referenceFinder = new FindReferences();
            var matchedNodes    = new List <AstNode>();

            var resolveResult = context.Resolver.Resolve(firstOrNullObject);
            var member        = resolveResult as MemberResolveResult;

            if (member == null)//not a member is unexpected case, so is better to return no match than to break the code
            {
                return(matchedNodes);
            }

            FoundReferenceCallback callback = (matchNode, result) => matchedNodes.Add(matchNode);

            var searchScopes = referenceFinder.GetSearchScopes(member.Member);

            referenceFinder.FindReferencesInFile(searchScopes,
                                                 context.UnresolvedFile,
                                                 context.RootNode as SyntaxTree,
                                                 context.Compilation, callback,
                                                 context.CancellationToken);
            return(matchedNodes);
        }
예제 #7
0
 void IAstVisitor.VisitVariableInitializer(VariableInitializer variableInitializer)
 {
     Visit(EnterVariableInitializer, LeaveVariableInitializer, variableInitializer);
 }
예제 #8
0
 public virtual S VisitVariableInitializer(VariableInitializer variableInitializer, T data)
 {
     return(VisitChildren(variableInitializer, data));
 }
예제 #9
0
 public static Init Init(NRefactory.VariableInitializer variableInitializer, IScope scope, INRefcatoryExpressionVisitor visitor)
 {
     return(new Init(variableInitializer, scope, visitor));
 }
 public virtual S VisitVariableInitializer(VariableInitializer variableInitializer, T data)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public override AstExpression VisitVariableInitializer(NRefactory.VariableInitializer variableInitializer, IScope scope)
 {
     return(AstExpression.Init(variableInitializer, scope, this));
 }