Examples of GoReturnStatement


Examples of ro.redeul.google.go.lang.psi.statements.GoReturnStatement

        GoFile file = get(parse("package main; func a() { return }"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());

        assertTrue(returnStmt.getExpressions().length == 0);
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.GoReturnStatement

        GoFile file = get(parse("package main; func a() { return 1}"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());

        assertNotNull(castAs(GoLiteralExpression.class,
                             0, returnStmt.getExpressions()));
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.GoReturnStatement

        GoFunctionDeclaration func =
            childAt(0, file.getFunctions());

        GoBlockStatement blockStmt = get(func.getBlock());

        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class, 0, blockStmt.getStatements());

        assertNotNull(
            castAs(GoLiteralExpression.class, 0, returnStmt.getExpressions()));

        assertNotNull(
            castAs(GoLiteralExpression.class, 1, returnStmt.getExpressions()));
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.GoReturnStatement

        GoFile file = get(parse("package main; func a() { return \"a\";\n}"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());

        assertNotNull(castAs(GoLiteralExpression.class,
                             0, returnStmt.getExpressions()));
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.GoReturnStatement

        GoFile file = get(parse("package main; func a() { return 1+2 }"));
        GoFunctionDeclaration func = childAt(0,
                                             file.getFunctions());
        GoBlockStatement blockStmt = get(func.getBlock());
        GoReturnStatement returnStmt =
            castAs(GoReturnStatement.class,
                   0, blockStmt.getStatements());

        assertNotNull(castAs(GoAdditiveExpression.class,
                             0, returnStmt.getExpressions()));
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.GoReturnStatement

                                    "package main\n" +
                                    "func Ok4() (int, int) {\n" +
                                    "    return int(1), 1\n" +
                                    "}"));

        GoReturnStatement statement =
            castAs(GoReturnStatement.class, 0,
                   get(
                       childAt(0,
                               file.getFunctions()
                       ).getBlock()
                   ).getStatements()
            );

        castAs(GoCallOrConvExpression.class, 0, statement.getExpressions());
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.statements.GoReturnStatement

    @Override
    protected void invoke(final Project project, final Editor editor, final GoFile file) {
        PsiElement element = file.findElementAt(editor.getSelectionModel().getSelectionStart());


        final GoReturnStatement expression;
        if (element.getParent() instanceof GoReturnStatement) {
            expression = (GoReturnStatement) element.getParent();
        } else {
            expression = element instanceof GoReturnStatement ?
                    (GoReturnStatement) element :
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.