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); } } }
public virtual void PostWalk(TryStatementHandler node) { }
// TryStatementHandler public virtual bool Walk(TryStatementHandler node) { return true; }
// TryStatementHandler public virtual bool Walk(TryStatementHandler node) { return(true); }
// TryStatementHandler public override bool Walk(TryStatementHandler node) { return(Location >= node.StartIndex && Location <= node.EndIndex); }
public override void PostWalk(TryStatementHandler node) { }
// TryStatementHandler public override bool Walk(TryStatementHandler node) { return Location >= node.StartIndex && Location <= node.EndIndex; }
public void PostWalk(TryStatementHandler node) { PostProcess(node); }
// 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)); }
public TryDefinition(TryStatement tryStatement, TryStatementHandler tryHandler) { this.tryStatement = tryStatement; this.tryHandler = tryHandler; }
// TryStatementHandler public override bool Walk(TryStatementHandler node) { return false; }
// TryStatementHandler public override bool Walk(TryStatementHandler node) { return(false); }