Examples of GoLiteralExpression


Examples of ro.redeul.google.go.lang.psi.expressions.primary.GoLiteralExpression

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

        final GoLiteralExpression expression = findParentOfType(element, GoLiteralExpression.class);
        assertNotNull(expression);
        assertInstanceOf(expression.getLiteral(), GoLiteralIdentifier.class);

        GoFunctionDeclaration goFunctionDeclaration = GoExpressionUtils.resolveToFunctionDeclaration(expression);
        assertNotNull(goFunctionDeclaration);
        final GoPsiType type = goFunctionDeclaration.getParameters()[1].getType();
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.primary.GoLiteralExpression

    public void testLiteralFunctionSmartGenVariadicArgs() throws Exception{ doTest(); }

    @Override
    protected void invoke(final Project project, final Editor editor, final GoFile file) {
        PsiElement element = file.findElementAt(editor.getSelectionModel().getSelectionStart());
        final GoLiteralExpression identifier = findParentOfType(element, GoLiteralExpression.class);
        assertNotNull(identifier);
        assertInstanceOf(identifier.getLiteral(), GoLiteralIdentifier.class);

        CommandProcessor.getInstance().executeCommand(project, new Runnable() {
            @Override
            public void run() {
                new CreateFunctionFix(identifier).invoke(project, file, editor, identifier, identifier);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.primary.GoLiteralExpression

        GoExpr fmtExpr = args[0];
        if (!(fmtExpr instanceof GoLiteralExpression)) {
            return;
        }

        GoLiteralExpression literalExpression = (GoLiteralExpression)fmtExpr;

        if (literalExpression.getLiteral() == null)
            return;

        GoLiteral literal = literalExpression.getLiteral();

        switch (literal.getType()) {
            case Identifier:
                literal = findConstDefinition((GoLiteralIdentifier)literal);
                if (literal == null ||
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.primary.GoLiteralExpression

        return fileImportPath.isEmpty() ? value : fileImportPath + "/" + value;
    }

    @Nullable
    public static GoPackage findSelectorPackage(GoSelectorExpression selectorExpression) {
        GoLiteralExpression literalExpression = getAs(GoLiteralExpression.class, selectorExpression.getBaseExpression());

        if ( literalExpression == null )
            return null;

        GoType types[] = literalExpression.getType();

        if ( types.length == 0 || types[0] == null || !(types[0] instanceof GoTypePackage) )
            return null;

        GoTypePackage typePackage = (GoTypePackage)types[0];
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.primary.GoLiteralExpression

            return null;
        }

        GoPrimaryExpression baseExpression = call.getBaseExpression();
        if (baseExpression instanceof GoLiteralExpression) {
            GoLiteralExpression literal = (GoLiteralExpression) baseExpression;
            PsiElement child = literal.getLiteral();
            return child instanceof GoLiteralIdentifier ? (GoLiteralIdentifier) child : null;
        }

        if (baseExpression instanceof GoSelectorExpression) {
            return GoUtil.ResolveReferece(baseExpression);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.primary.GoLiteralExpression

        if (keyExpression == null)
            return null;

        if (keyExpression instanceof GoLiteralExpression) {
            GoLiteralExpression expression = (GoLiteralExpression) keyExpression;

            if (expression.getLiteral() instanceof GoLiteralIdentifier) {
                return (GoLiteralIdentifier) expression.getLiteral();
            }
        }

        return null;
    }
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.