Examples of GoStatement


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

    }

    protected void introduceCurrentOccurrence(GoExpr e) throws GoRefactoringException {
        int start = e.getTextOffset();
        int end = start + e.getTextLength();
        GoStatement stmt = findParentOfType(e, GoStatement.class);
        int lineStart = document.getLineStartOffset(document.getLineNumber(stmt.getTextOffset()));
        String declaration = getExpressionDeclaration(e);

        RangeMarker range = document.createRangeMarker(lineStart, end);
        editor.getCaretModel().moveToOffset(end);
View Full Code Here

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

    }

    private Set<PsiElement> getParentsOfIdentifierDeclarations(Map<GoLiteralIdentifier, PsiElement> identifiers) {
        Set<PsiElement> parents = new HashSet<PsiElement>();
        for (PsiElement element : identifiers.values()) {
            GoStatement statement = findParentOfType(element, GoStatement.class);
            if (statement != null) {
                parents.add(statement.getParent());
            }
        }
        return parents;
    }
View Full Code Here

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

        return node != null && node.getNode().getElementType() == type;
    }

    public static SearchScope getLocalElementSearchScope(GoPsiElement element) {
        GoStatement statement = findParentOfType(element, GoStatement.class);
        if (statement == null) {
            GoFunctionDeclaration functionDeclaration = findParentOfType(element, GoFunctionDeclaration.class);
            if (functionDeclaration != null) {
                return new LocalSearchScope(functionDeclaration);
            }
            return new LocalSearchScope(element);
        }

        PsiElement scope = statement.getParent();
        if (scope instanceof GoVarDeclarations) {
            scope = scope.getParent();
        }

        if (scope == null) {
View Full Code Here

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

            GoStatement[] statements = clause.getStatements();
            if (statements.length == 0) {
                continue;
            }

            GoStatement lastStatement = statements[statements.length - 1];
            if (isNodeOfType(lastStatement, GoElementTypes.FALLTHROUGH_STATEMENT)) {
                int start = lastStatement.getTextOffset() - se.getTextOffset();
                String msg = GoIntentionsBundle.message("error.refuse.to.convert.fallthrough");
                throw new IntentionExecutionException(msg, start, lastStatement.getTextLength());
            }
        }
    }
View Full Code Here

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

    @Override
    public void invoke(@NotNull final Project project, @NotNull final PsiFile file,
                       @Nullable("is null when called from inspection") final Editor editor,
                       @NotNull final PsiElement startElement, @NotNull PsiElement endElement) {
        GoStatement statement = findParentOfType(startElement, GoStatement.class);
        if (statement == null || editor == null) {
            return;
        }

        final Document doc = PsiDocumentManager.getInstance(project).getDocument(file);

        if (doc == null) {
            return;
        }

        final RangeMarker rangeMarker;
        final int line = doc.getLineNumber(statement.getTextOffset());
        String variableName = startElement.getText();

        if (expressionIsTheWholeStatement(startElement, statement)) {
            doc.deleteString(doc.getLineStartOffset(line), doc.getLineEndOffset(line) + 1);
            rangeMarker = null;
View Full Code Here

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

    @Override
    public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                       @NotNull ResolveState state,
                                       PsiElement lastParent,
                                       @NotNull PsiElement place) {
        GoStatement init = getInitialStatement();

        if (init != null) {
            if ( ! processor.execute(init, state) )
                return false;
        }
View Full Code Here

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

    @Override
    public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                       @NotNull ResolveState state,
                                       PsiElement lastParent,
                                       @NotNull PsiElement place) {
        GoStatement statement = getStatement();

        return !(lastParent == null && statement != null) || statement.processDeclarations(processor, state, lastParent, place);

    }
View Full Code Here

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

        GoForWithClausesStatement forStatement = findParentOfType(element, GoForWithClausesStatement.class);
        if (forStatement == null) {
            return false;
        }

        GoStatement statement = forStatement.getInitialStatement();
        return statement != null && statement.getTextRange().contains(element.getTextRange());
    }
View Full Code Here

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

            moveSimpleStatementOut(editor, forStatement);
        }
    }

    private static void moveSimpleStatementOut(Editor editor, GoForWithClausesStatement forStatement) {
        GoStatement simpleStatement = forStatement.getInitialStatement();
        PsiElement semi = findChildOfType(forStatement, GoTokenTypes.oSEMI);
        if (simpleStatement == null || semi == null) {
            return;
        }

        int start = simpleStatement.getTextOffset();
        int end = semi.getTextOffset();
        move(editor, forStatement, simpleStatement.getText(), start, end);
    }
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.