Examples of GoSwitchTypeStatement


Examples of ro.redeul.google.go.lang.psi.statements.switches.GoSwitchTypeStatement

                      "             return 1\n" +
                      "     }\n" +
                      "     return nil\n" +
                      "}\n"));

        GoSwitchTypeStatement typeSwitch =
            castAs(GoSwitchTypeStatement.class, 0,
                   get(
                       get(
                           file.getMainFunction()
                       ).getBlock()
                   ).getStatements()
            );

        assertNull(typeSwitch.getSimpleStatement());

        GoSwitchTypeGuard typeGuard = get(typeSwitch.getTypeGuard());

        assertNull(typeGuard.getIdentifier());
        assertEquals("x", get(typeGuard.getExpression()).getText());

        GoSwitchTypeClause clause = childAt(0, typeSwitch.getClauses());

        assertEquals(true, clause.isDefault());

        assertEquals(1, clause.getStatements().length);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.switches.GoSwitchTypeStatement

                      "             return x\n" +
                      "     }\n" +
                      "     return nil\n" +
                      "}\n"));

        GoSwitchTypeStatement exprSwitch =
            castAs(GoSwitchTypeStatement.class, 0,
                   get(
                       get(
                           file.getMainFunction()
                       ).getBlock()
                   ).getStatements()
            );

        assertEquals("x := 1", get(exprSwitch.getSimpleStatement()).getText());
        assertEquals("x",
                     get(exprSwitch.getTypeGuard().getExpression()).getText());
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.switches.GoSwitchTypeStatement

                      "             return x\n" +
                      "     }\n" +
                      "     return nil\n" +
                      "}\n"));

        GoSwitchTypeStatement exprSwitch =
            castAs(GoSwitchTypeStatement.class, 0,
                   get(
                       get(
                           file.getMainFunction()
                       ).getBlock()
                   ).getStatements()
            );

        assertNull(exprSwitch.getSimpleStatement());
        assertEquals("x",
                     get(
                         get(
                             exprSwitch.getTypeGuard()
                         ).getExpression()
                     ).getText());

        GoSwitchTypeClause clause = childAt(0, exprSwitch.getClauses());

        assertEquals(3, clause.getTypes().length);
        assertEquals("int", childAt(0, clause.getTypes()).getText());
        assertEquals("float", childAt(1, clause.getTypes()).getText());
        assertEquals("T", childAt(2, clause.getTypes()).getText());
        assertFalse(clause.isDefault());

        clause = childAt(1, exprSwitch.getClauses());

        assertEquals(1, clause.getTypes().length);
        assertEquals("complex32", childAt(0, clause.getTypes()).getText());
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.switches.GoSwitchTypeStatement

                    return false;
                }
            }
            return hasDefalut;
        }else if (statement instanceof GoSwitchTypeStatement){
            GoSwitchTypeStatement switchTypeStatement = (GoSwitchTypeStatement)statement;
            boolean hasDefalut = false;
            for (GoSwitchTypeClause clause: switchTypeStatement.getClauses()) {
                if (clause.isDefault()) {
                    hasDefalut = true;
                }
                GoStatement[] statmentsInClause = clause.getStatements();
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.switches.GoSwitchTypeStatement

                    }


                    @Override
                    public void visitSwitchTypeGuard(GoSwitchTypeGuard typeGuard) {
                        GoSwitchTypeStatement switchStatement = (GoSwitchTypeStatement) typeGuard.getParent();

                        TextRange litRange = identifier.getTextRange();
                        for (GoSwitchTypeClause clause : switchStatement.getClauses()) {
                            TextRange clauseTextRange = clause.getTextRange();
                            if (clauseTextRange.contains(litRange)) {
                                setData(GoTypes.fromPsiType(clause.getTypes()));
                            }
                        }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.switches.GoSwitchTypeStatement

        if (seStmt != null) {
            GoSimpleStatement ss = seStmt.getSimpleStatement();
            return ss != null && ss.getTextRange().contains(element.getTextRange());
        }

        GoSwitchTypeStatement stStmt = findParentOfType(element, GoSwitchTypeStatement.class);
        if (stStmt != null) {
            GoSimpleStatement ss = stStmt.getSimpleStatement();
            return ss != null && ss.getTextRange().contains(element.getTextRange());
        }
        return false;
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.switches.GoSwitchTypeStatement

        if (seStmt != null) {
            moveSimpleStatementOut(editor, seStmt);
            return;
        }

        GoSwitchTypeStatement stStmt = findParentOfType(element, GoSwitchTypeStatement.class);
        if (stStmt != null) {
            moveSimpleStatementOut(editor, stStmt);
            return;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.