@Override public void visitGotoStatement(GotoStatementTree tree) { complexity.addComplexityWithoutNesting(tree.gotoToken()); super.visitGotoStatement(tree); }
@Test public void test() throws Exception { GotoStatementTree tree = parse(" goto a ;", PHPLexicalGrammar.GOTO_STATEMENT); assertThat(tree.is(Kind.GOTO_STATEMENT)).isTrue(); assertThat(tree.gotoToken().text()).isEqualTo("goto"); assertThat(tree.identifier().text()).isEqualTo("a"); assertThat(tree.eosToken().text()).isEqualTo(";"); }
private PhpCfgBlock buildGotoStatement(GotoStatementTree tree, PhpCfgBlock successor) { String label = tree.identifier().text(); PhpCfgBlock gotoTarget = labelledBlocks.get(label); PhpCfgBlock newBlock; if (gotoTarget == null) { newBlock = createBlockWithSyntacticSuccessor(end, successor); List<PhpCfgBlock> gotosList = gotosWithoutTarget.computeIfAbsent(label, k -> new LinkedList<>()); gotosList.add(newBlock); } else { newBlock = createBlockWithSyntacticSuccessor(gotoTarget, successor); } newBlock.addElement(tree); return newBlock; }
private PhpCfgBlock buildGotoStatement(GotoStatementTree tree, PhpCfgBlock successor) { String label = tree.identifier().text(); PhpCfgBlock gotoTarget = labelledBlocks.get(label); PhpCfgBlock newBlock; if (gotoTarget == null) { newBlock = createBlockWithSyntacticSuccessor(end, successor); List<PhpCfgBlock> gotosList = gotosWithoutTarget.computeIfAbsent(label, k -> new LinkedList<>()); gotosList.add(newBlock); } else { newBlock = createBlockWithSyntacticSuccessor(gotoTarget, successor); } newBlock.addElement(tree); return newBlock; }
@Override public void visitGotoStatement(GotoStatementTree tree) { complexity.addComplexityWithoutNesting(tree.gotoToken()); super.visitGotoStatement(tree); }
@Override public void visitGotoStatement(GotoStatementTree tree) { context().newIssue(this, tree.gotoToken(), MESSAGE); super.visitGotoStatement(tree); }
@Override public void visitGotoStatement(GotoStatementTree tree) { context().newIssue(this, tree.gotoToken(), MESSAGE); super.visitGotoStatement(tree); }