Пример #1
0
        override public void OnGotoStatement(GotoStatement node)
        {
            LabelStatement target = ((InternalLabel)node.Label.Entity).LabelStatement;

            int gotoDepth   = ContextAnnotations.GetTryBlockDepth(node);
            int targetDepth = ContextAnnotations.GetTryBlockDepth(target);

            if (gotoDepth < targetDepth)
            {
                BranchError(node, target);
            }
            else if (gotoDepth == targetDepth)
            {
                Node gotoParent  = AstUtil.GetParentTryExceptEnsure(node);
                Node labelParent = AstUtil.GetParentTryExceptEnsure(target);
                if (gotoParent != labelParent)
                {
                    BranchError(node, target);
                }
            }
        }