public override Node Visit(Node node)
{
if (node == null) return null;
//
// Short-circuit unsupported node types here and throw an exception
//
switch (node.NodeType)
{
case NodeType.Yield:
case NodeType.AddressDereference:
case NodeType.AliasDefinition:
case NodeType.Assembly:
case NodeType.AssemblyReference:
case NodeType.Attribute:
case NodeType.Base:
case NodeType.BlockExpression:
case NodeType.Branch:
case NodeType.Catch:
case NodeType.Composition:
case NodeType.ConstrainedType:
case NodeType.ConstructArray:
case NodeType.ConstructDelegate:
case NodeType.ConstructFlexArray:
case NodeType.ConstructIterator:
case NodeType.ConstructTuple:
case NodeType.Continue:
case NodeType.DelegateNode:
case NodeType.DoWhile:
case NodeType.EndFilter:
case NodeType.EndFinally:
case NodeType.Event:
case NodeType.Exit:
case NodeType.ExpressionSnippet:
case NodeType.FaultHandler:
case NodeType.FieldInitializerBlock:
case NodeType.Filter:
case NodeType.Finally:
case NodeType.For:
case NodeType.Interface:
case NodeType.InterfaceExpression:
case NodeType.InstanceInitializer:
case NodeType.Local:
case NodeType.LRExpression:
case NodeType.Module:
case NodeType.NameBinding:
case NodeType.NamedArgument:
case NodeType.PrefixExpression:
case NodeType.PostfixExpression:
case NodeType.Property:
case NodeType.Repeat:
case NodeType.SetterValue:
case NodeType.StatementSnippet:
case NodeType.StaticInitializer:
case NodeType.Switch:
case NodeType.SwitchCase:
case NodeType.SwitchInstruction:
case NodeType.Typeswitch:
case NodeType.TypeswitchCase:
case NodeType.Try:
case NodeType.TypeAlias:
case NodeType.TypeMemberSnippet:
case NodeType.TypeParameter:
throw new InvalidOperationException(
string.Format(CultureInfo.CurrentUICulture,
"Invalid node type for Zing ({0})", node.NodeType));
default:
break;
}
switch (((ZingNodeType)node.NodeType))
{
case ZingNodeType.Array:
return this.VisitArray((ZArray)node);
case ZingNodeType.Accept:
return this.VisitAccept((AcceptStatement)node);
case ZingNodeType.Assert:
return this.VisitAssert((AssertStatement)node);
case ZingNodeType.Assume:
return this.VisitAssume((AssumeStatement)node);
case ZingNodeType.Async:
return this.VisitAsync((AsyncMethodCall)node);
case ZingNodeType.Atomic:
return this.VisitAtomic((AtomicBlock)node);
case ZingNodeType.AttributedStatement:
return this.VisitAttributedStatement((AttributedStatement)node);
case ZingNodeType.Chan:
return this.VisitChan((Chan)node);
case ZingNodeType.Choose:
return this.VisitChoose((UnaryExpression)node);
case ZingNodeType.EventPattern:
return this.VisitEventPattern((EventPattern)node);
case ZingNodeType.Event:
return this.VisitEventStatement((EventStatement)node);
case ZingNodeType.In:
return this.VisitIn((BinaryExpression)node);
case ZingNodeType.JoinStatement:
return this.VisitJoinStatement((JoinStatement)node);
case ZingNodeType.InvokePlugin:
return this.VisitInvokePlugin((InvokePluginStatement)node);
case ZingNodeType.Range:
return this.VisitRange((Range)node);
case ZingNodeType.ReceivePattern:
return this.VisitReceivePattern((ReceivePattern)node);
case ZingNodeType.Select:
return this.VisitSelect((Select)node);
case ZingNodeType.Send:
return this.VisitSend((SendStatement)node);
case ZingNodeType.Set:
return this.VisitSet((Set)node);
case ZingNodeType.Trace:
return this.VisitTrace((TraceStatement)node);
case ZingNodeType.TimeoutPattern:
return this.VisitTimeoutPattern((TimeoutPattern)node);
case ZingNodeType.Try:
return this.VisitZTry((ZTry)node);
case ZingNodeType.WaitPattern:
return this.VisitWaitPattern((WaitPattern)node);
case ZingNodeType.With:
return this.VisitWith((With)node);
default:
if (node.NodeType == NodeType.TypeExpression)
return this.VisitTypeExpression((TypeExpression)node);
return base.Visit(node);
}
}