public void GotoDefaultCase()
        {
            const string codeText = @"public void Switch()
                                {
                                    switch (0)
                                    {
                                        case 0:
                                            goto default;
                                        default:
                                            break;
                                    }

                                }";

            var md = AstMatchHelper.ParseToMethodDeclaration(codeText);
            FindJumpInstructionsVisitor v = new FindJumpInstructionsVisitor(md, new MySelection(md.Body.Children));
            md.AcceptVisitor(v, null);

            Assert.IsTrue(v.IsOk);
        }
Ejemplo n.º 2
0
		protected ErrorKind CheckForJumpInstructions(MethodDeclaration method)
		{
			FindJumpInstructionsVisitor fjiv = new FindJumpInstructionsVisitor(method);
			
			method.AcceptVisitor(fjiv, null);
			return fjiv.DoCheck();
		}
		protected static bool CheckForJumpInstructions(MethodDeclaration method, ISelection selection)
		{
			FindJumpInstructionsVisitor fjiv = new FindJumpInstructionsVisitor(method, selection);
			
			method.AcceptVisitor(fjiv, null);
			
			return fjiv.IsOk;
		}
        public void GotoTargetOccursBefore()
        {
            const string codeText = @"public void Switch()
                                {
                                    fred:
                                        return;
                                    goto fred;
                                }";

            var md = AstMatchHelper.ParseToMethodDeclaration(codeText);
            FindJumpInstructionsVisitor v = new FindJumpInstructionsVisitor(md, new MySelection(md.Body.Children));
            md.AcceptVisitor(v, null);

            Assert.IsTrue(v.IsOk);
        }