예제 #1
0
        public static bool TryGetCompletions(TryStatementHandler tryStatement, CompletionContext context, out CompletionResult result)
        {
            result = CompletionResult.Empty;

            // except Test as Target
            if (tryStatement.Target != null && context.Position >= tryStatement.Target.StartIndex)
            {
                return(true);
            }

            if (tryStatement.Test is TupleExpression || tryStatement.Test is null)
            {
                return(false);
            }

            if (context.Position <= tryStatement.Test.EndIndex)
            {
                return(false);
            }

            var applicableSpan = context.GetApplicableSpanFromLastToken(tryStatement);

            result = new CompletionResult(Enumerable.Repeat(CompletionItemSource.AsKeyword, 1), applicableSpan);
            return(true);
        }
 public void Analyze(TryStatement ts)
 {
     this.tryStatement = ts;
     foreach (TryStatementHandler tsh in tryStatement.Handlers)
     {
         this.tryHandler = tsh;
         if (tsh.Target != null)
         {
             tsh.Target.Walk(this);
         }
     }
 }
예제 #3
0
 public virtual void PostWalk(TryStatementHandler node) { }
예제 #4
0
 // TryStatementHandler
 public virtual bool Walk(TryStatementHandler node) { return true; }
예제 #5
0
 public virtual void PostWalk(TryStatementHandler node)
 {
 }
예제 #6
0
 // TryStatementHandler
 public virtual bool Walk(TryStatementHandler node)
 {
     return(true);
 }
예제 #7
0
 // TryStatementHandler
 public override bool Walk(TryStatementHandler node)
 {
     return(Location >= node.StartIndex && Location <= node.EndIndex);
 }
예제 #8
0
 public override void PostWalk(TryStatementHandler node)
 {
 }
예제 #9
0
 // TryStatementHandler
 public override bool Walk(TryStatementHandler node) { return Location >= node.StartIndex && Location <= node.EndIndex; }
예제 #10
0
 public void PostWalk(TryStatementHandler node)
 {
     PostProcess(node);
 }
예제 #11
0
 // TryStatementHandler
 public bool Walk(TryStatementHandler node)
 {
     return(Process(node));
 }
 public override void PostWalk(TryStatementHandler node)
 {
     PostWalkWorker(node);
 }
 // TryStatementHandler
 public override bool Walk(TryStatementHandler node)
 {
     return(ShouldWalkWorker(node));
 }
예제 #14
0
 public TryDefinition(TryStatement tryStatement, TryStatementHandler tryHandler)
 {
     this.tryStatement = tryStatement;
     this.tryHandler   = tryHandler;
 }
예제 #15
0
 // TryStatementHandler
 public override bool Walk(TryStatementHandler node) { return false; }
예제 #16
0
 public override void PostWalk(TryStatementHandler node) { }
예제 #17
0
 // TryStatementHandler
 public override bool Walk(TryStatementHandler node)
 {
     return(false);
 }