Examples of GoLiteralIdentifier


Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        PsiElement parent = element.getParent();
        if (!(parent instanceof GoLabeledStatement)) {
            return false;
        }

        GoLiteralIdentifier label = ((GoLabeledStatement) parent).getLabel();
        String name = getElement().getName();
        if (label == null || name == null || name.isEmpty() || !name.equals(
                label.getName())) {
            return false;
        }

        PsiElement resolve = resolve();
        return resolve != null && resolve.getTextOffset() == element.getTextOffset();
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        new GoRecursiveElementVisitor() {
            @Override
            public void visitLabeledStatement(GoLabeledStatement statement) {
                super.visitLabeledStatement(statement);

                GoLiteralIdentifier label = statement.getLabel();
                if (label != null) {
                    labels.add(label.getName());
                }
            }

            @Override
            public void visitFunctionLiteral(GoLiteralFunction literal) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        if (parentValue == null)
            return GoType.Unknown;

        GoType parentType = parentValue.getType();

        final GoLiteralIdentifier elementKey = getKey();

        return parentType.underlyingType().accept(new TypeVisitor<GoType>(GoType.Unknown) {
            @Override
            public GoType visitArray(GoTypeArray type) {
                return type.getElementType();
            }

            @Override
            public GoType visitSlice(GoTypeSlice type) {
                return type.getElementType();
            }

            @Override
            public GoType visitMap(GoTypeMap type) {
                return type.getElementType();
            }

            @Override
            public GoType visitStruct(GoTypeStruct type) {
                if (elementKey == null)
                    return GoType.Unknown;

                GoPsiTypeStruct structPsi = type.getPsiType();

                for (GoTypeStructField field : structPsi.getFields()) {
                    for (GoLiteralIdentifier fieldName : field.getIdentifiers()) {
                        if (fieldName.getName().equals(elementKey.getName()))
                            return GoTypes.fromPsi(field.getType());
                    }
                }

                for (GoTypeStructAnonymousField field : structPsi.getAnonymousFields()) {
                    if (field.getFieldName().equals(elementKey.getName()))
                        return GoTypes.fromPsi(field.getType());
                }

                return GoType.Unknown;
            }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        super(node);
    }

    @Override
    public boolean isBlank() {
        GoLiteralIdentifier identifiers[] = getIdentifiers();

        return identifiers.length == 1 && identifiers[0].isBlank();
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        }

        if ( element instanceof GoShortVarDeclaration) {
            GoShortVarDeclaration shortVarDeclaration = (GoShortVarDeclaration) element;

            GoLiteralIdentifier identifiers[] = shortVarDeclaration.getIdentifiers();

            for (GoLiteralIdentifier identifier : identifiers) {

                if (identifier.getName() == null) {
                    return false;
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

                        declaration.getMethodReceiver().getType() == null) {
                    visitElement(declaration);
                    return;
                }
                blockNameStack.push(new HashSet<String>());
                GoLiteralIdentifier id = declaration.getMethodReceiver().getIdentifier();
                nameCheck(id, result);
                for (GoFunctionParameter parameter : declaration.getParameters()) {
                    for (GoLiteralIdentifier paramterId : parameter.getIdentifiers()) {
                        nameCheck(paramterId, result);
                    }
                }
                for (GoFunctionParameter parameter : declaration.getResults()) {
                    for (GoLiteralIdentifier paramterId : parameter.getIdentifiers()) {
                        nameCheck(paramterId, result);
                    }
                }

                visitElement(declaration);
                blockNameStack.pop();
                String name = declaration.getMethodReceiver().getType().getText() + "." + declaration.getName();
                if (name.startsWith("*")) {
                    name = name.substring(1);
                }
                if (methodNameSet.contains(name)) {
                    result.addProblem(declaration.getNameIdentifier(), GoBundle.message("error.redeclare"),
                            ProblemHighlightType.GENERIC_ERROR);
                    return;
                }
                methodNameSet.add(name);
            }

            @Override
            public void visitFunctionDeclaration(GoFunctionDeclaration declaration) {
                blockNameStack.push(new HashSet<String>());
                for (GoFunctionParameter parameter : declaration.getParameters()) {
                    for (GoLiteralIdentifier parameterIdentifier : parameter.getIdentifiers()) {
                        nameCheck(parameterIdentifier, result);
                    }
                }
                for (GoFunctionParameter parameter : declaration.getResults()) {
                    for (GoLiteralIdentifier parameterIdentifier : parameter.getIdentifiers()) {
                        nameCheck(parameterIdentifier, result);
                    }
                }

                visitElement(declaration);
                blockNameStack.pop();
                if (!declaration.isInit())
                    nameCheck(declaration.getNameIdentifier(), declaration.getName(), result);
            }

            @Override
            public void visitFunctionLiteral(GoLiteralFunction declaration) {
                blockNameStack.push(new HashSet<String>());
                for (GoFunctionParameter parameter : declaration.getParameters()) {
                    for (GoLiteralIdentifier parameterIdentifier : parameter.getIdentifiers()) {
                        nameCheck(parameterIdentifier, result);
                    }
                }
                for (GoFunctionParameter parameter : declaration.getResults()) {
                    for (GoLiteralIdentifier parameterIdentifier : parameter.getIdentifiers()) {
                        nameCheck(parameterIdentifier, result);
                    }
                }
                visitElement(declaration);
                blockNameStack.pop();

            }


            @Override
            public void visitTypeNameDeclaration(GoTypeNameDeclaration declaration) {
                nameCheck(declaration, declaration.getName(), result);
                visitElement(declaration);
            }

            @Override
            public void visitConstDeclaration(GoConstDeclaration declaration) {
                GoLiteralIdentifier[] ids = declaration.getIdentifiers();
                for (GoLiteralIdentifier id : ids) {
                    nameCheck(id, result);
                }
                visitElement(declaration);
            }

            @Override
            public void visitVarDeclaration(GoVarDeclaration declaration) {
                GoLiteralIdentifier[] ids = declaration.getIdentifiers();
                for (GoLiteralIdentifier id : ids) {
                    nameCheck(id, result);
                }
                visitElement(declaration);
            }

            @Override
            public void visitShortVarDeclaration(GoShortVarDeclaration declaration) {
                GoLiteralIdentifier[] ids = declaration.getIdentifiers();
                boolean isAllRepeat = true;
                for (GoLiteralIdentifier id : ids) {
                    if (id.isBlank()) {
                        continue;
                    }
                    String idName = id.getName();
                    if (!blockNameStack.peek().contains(idName)) {
                        isAllRepeat = false;
                        blockNameStack.peek().add(idName);
                    }
                }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        return true;
    }

    private void collectVariableDeclaration(GoVarDeclaration declaration, ResolveState state) {

        GoLiteralIdentifier identifiers[] = declaration.getIdentifiers();

        boolean isImported = isImported(state);

        for (GoLiteralIdentifier identifier : identifiers) {
            if ( ! isImported || GoNamesUtil.isExported(identifier.getName()) ) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        }
    }

    private void collectVariableDeclaration(GoConstDeclaration declaration, ResolveState state) {

        GoLiteralIdentifier identifiers[] = declaration.getIdentifiers();

        boolean isImported = isImported(state);

        for (GoLiteralIdentifier identifier : identifiers) {
            if ( ! isImported || GoNamesUtil.isExported(identifier.getName()) ) {
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

        super(node);
    }

    @NotNull
    public String getFunctionName() {
        GoLiteralIdentifier nameIdentifier = getNameIdentifier();
        return nameIdentifier != null ? nameIdentifier.getName() : "";
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralIdentifier

    }

    @NotNull
    @Override
    public PsiElement getNavigationElement() {
        GoLiteralIdentifier nameIdentifier = getNameIdentifier();
        return nameIdentifier != null ? nameIdentifier : this;
    }
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.