Examples of GoSelectStatement


Examples of ro.redeul.google.go.lang.psi.statements.select.GoSelectStatement

public class GoPsiSelectStatementTest extends GoPsiTestCase {

    public void testSimpleSelect() throws Exception {
        GoFile file = get(parse("package main; func main() { select {} }"));

        GoSelectStatement selectStatement =
            castAs(GoSelectStatement.class, 0,
                   get(
                       childAt(0,
                               file.getFunctions()
                       ).getBlock()
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.select.GoSelectStatement

                                    "   select {" +
                                    "       default:{}" +
                                    "   } " +
                                    "}"));

        GoSelectStatement selectStatement =
            castAs(GoSelectStatement.class, 0,
                   get(
                       childAt(0,
                               file.getFunctions()
                       ).getBlock()
                   ).getStatements()
            );

        assertEquals(1, selectStatement.getCommClauses().length);

        GoSelectCommClauseDefault commClauseDefault =
            castAs(
                GoSelectCommClauseDefault.class,
                0, selectStatement.getCommClauses());

        assertEquals(commClauseDefault.getText(), "default:{}");
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.select.GoSelectStatement

                                    "   select {" +
                                    "       case i1 = <-c1: {}" +
                                    "   } " +
                                    "}"));

        GoSelectStatement selectStatement =
            castAs(GoSelectStatement.class, 0,
                   get(
                       childAt(0,
                               file.getFunctions()
                       ).getBlock()
                   ).getStatements()
            );

        assertEquals(1, selectStatement.getCommClauses().length);

        GoSelectCommClauseRecv clauseRecv =
            castAs(GoSelectCommClauseRecv.class,
                   0, selectStatement.getCommClauses());


        assertNotNull(clauseRecv.getAssignment());
        GoExpr[] expressions = clauseRecv.getAssignment().getLeftSideExpressions().getExpressions();
        assertEquals(1, expressions.length);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.select.GoSelectStatement

                                    "   select {" +
                                    "       case i1 := <-c1: {}" +
                                    "   } " +
                                    "}"));

        GoSelectStatement selectStatement =
            castAs(GoSelectStatement.class, 0,
                   get(
                       childAt(0,
                               file.getFunctions()
                       ).getBlock()
                   ).getStatements()
            );

        assertEquals(1, selectStatement.getCommClauses().length);

        GoSelectCommClauseRecv clauseRecv =
            castAs(GoSelectCommClauseRecv.class,
                   0, selectStatement.getCommClauses());

        assertNotNull(clauseRecv.getShortVarDeclaration());

        assertEquals(1, clauseRecv.getShortVarDeclaration().getDeclarations().length);
        assertEquals("i1", childAt(0, clauseRecv.getShortVarDeclaration().getDeclarations()).getText());
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.select.GoSelectStatement

                    return false;
                }
            }
            return hasDefalut;
        }else if (statement instanceof GoSelectStatement){
            GoSelectStatement selectStatement = (GoSelectStatement)statement;
            for (GoSelectCommClause clause : selectStatement.getCommClauses()) {
                GoStatement[] statmentsInClause = clause.getStatements();
                if (statmentsInClause.length == 0) {
                    return false;
                }
                if (!isTerminating(statmentsInClause[statmentsInClause.length-1])){
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.