internal static AST Convert(Node node) { AST ast; if (node is TryStatementHandler) ast = new ExceptHandler((TryStatementHandler)node); else throw new ArgumentTypeException("Unexpected node type: " + node.GetType()); ast.GetSourceLocation(node); return ast; }
private void PushContext(Node n) { Debug.Assert(contextType != null && n.GetType() == contextType); if (context == null) { context = new Stack<Node>(); } context.Push(n); }
private bool Process(Node node) { if (contextType != null && node.GetType() == contextType) { PushContext(node); } if (node.Start <= location && location < node.End) { SaveCandidate(node); } return true; }
private void PostProcess(Node node) { if (contextType != null && node.GetType() == contextType) { PopContext(node); } }
private void PopContext(Node n) { Debug.Assert(contextType != null && n.GetType() == contextType); Debug.Assert(context != null && context.Count > 0); Node n2 = context.Pop(); Debug.Assert((object)n2 == (object)n); }
private ISet<Namespace> EvaluateWorker(Node node) { EvalDelegate eval; if (_evaluators.TryGetValue(node.GetType(), out eval)) { return eval(this, node); } return EmptySet<Namespace>.Instance; }