Examples of GoLiteralString


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

        GoVarDeclaration[] declarations =
            childAt(0,
                    file.getGlobalVariables()
            ).getDeclarations();

        GoLiteralString string =
            getAs(GoLiteralString.class,
                  getAs(GoLiteralExpression.class,
                        childAt(0,
                                declarations[0].getExpressions()
                        )
                  ).getLiteral()
            );

        assertEquals(GoLiteral.Type.InterpretedString, string.getType());
        assertEquals("a", string.getValue());

        string =
            getAs(GoLiteralString.class,
                  getAs(GoLiteralExpression.class,
                        childAt(0,
                                declarations[1].getExpressions()
                        )
                  ).getLiteral()
            );

        assertEquals(GoLiteral.Type.RawString, string.getType());
        assertEquals("b", string.getValue());


        GoLiteralChar aChar =
                getAs(GoLiteralChar.class,
                        getAs(GoLiteralExpression.class,
View Full Code Here

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


                                        PsiFile[] files = null;

                                        VirtualFile packageFile = null;
                                        GoLiteralString importPath = declaration.getImportPath();
                                        if (importPath != null)
                                            packageFile = project.getBaseDir().findFileByRelativePath("src/" + importPath.getValue());

                                        if (packageFile != null) {
                                            PsiDirectory directory = PsiManager.getInstance(project).findDirectory(packageFile);
                                            if (directory != null)
                                                files = directory.getFiles();
View Full Code Here

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

        final Project project = goFile.getProject();
        final Set<GoImportDeclaration> unusedImports =
            new HashSet<GoImportDeclaration>(UnusedImportsFinder.findUnusedImports(goFile));

        for (GoImportDeclaration id : unusedImports) {
            GoLiteralString importPath = id.getImportPath();
            if (importPath == null) {
                return;
            }

            // refuse to optimize anything if there are some import whose path looks strange.
            String path = importPath.getValue();
            if (path.contains("\n") || path.contains(" ") || path.contains("\t")) {
                return;
            }
        }
View Full Code Here

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

                    literal.getType() != InterpretedString &&
                    literal.getType() != RawString)
                   break;
            case InterpretedString:
            case RawString:
                GoLiteralString stringLiteral = (GoLiteralString) literal;
                Context ctx = new Context(stringLiteral,
                                          result,
                                          Arrays.copyOfRange(args, 1, args.length),
                                          isScanning);
                checkFormat(stringLiteral.getValue(), ctx);
                ctx.checkAllExtraParameters();
        }
    }
View Full Code Here

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

        return this;
    }

    @Override
    public TextRange getRangeInElement() {
        GoLiteralString importPath = getElement().getImportPath();
        if (importPath == null) {
            return TextRange.EMPTY_RANGE;
        }

        return new TextRange(
                importPath.getStartOffsetInParent(),
                importPath.getStartOffsetInParent() + importPath.getTextLength()
        );
    }
View Full Code Here

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

    }

    @NotNull
    @Override
    public String getCanonicalText() {
        GoLiteralString importPath = getElement().getImportPath();
        return importPath == null ? "" : importPath.getValue();
    }
View Full Code Here

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

    }

    @NotNull
    @Override
    public ResolveResult[] multiResolve(boolean incompleteCode) {
        GoLiteralString importPath = element.getImportPath();
        if (importPath == null) {
            return ResolveResult.EMPTY_ARRAY;
        }

        GoNamesCache namesCache = GoNamesCache.getInstance(element.getProject());

        List<ResolveResult> files = new ArrayList<ResolveResult>();
        for (GoFile file : namesCache.getFilesByPackageImportPath(importPath.getValue())) {
            files.add(new PsiElementResolveResult(file.getOriginalFile()));
        }

        Collections.sort(files, new Comparator<ResolveResult>() {
            @Override
View Full Code Here

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

            GoPackageReference packageReference = importSpec.getPackageReference();

            if (packageReference == null) {
                // If there is no package reference but the import path contains
                // a ".', treat it like a package reference were specfied.
                GoLiteralString importPath = importSpec.getImportPath();
                if (importPath != null) {
                    String path = importPath.getValue();
                    if (isDotImport(path)) {
                        path = findDefaultPackageName(path);
                    }
                    packageImports.add(path);
                }
View Full Code Here

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

        if (!GoResolveUtil.inSamePackage(qualifiedName, importSpec)) {
            return true;
        }

        GoLiteralString literalString = importSpec.getImportPath();
        if ( literalString == null )
            return true;

        String importPath = literalString.getValue();

        GoFile[] importedFiles = GoPsiUtils.findFilesForPackage(importPath, (GoFile) ((PsiElement)this.qualifiedName).getContainingFile().getOriginalFile());

        for (GoFile importedFile : importedFiles) {
            if (!importedFile.processDeclarations(this, state, null, element)) {
View Full Code Here

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

    public static boolean inSamePackage(GoQualifiedNameElement qualifiedElement, GoImportDeclaration importSpec) {
        GoPackageReference importedPackageReference = importSpec.getPackageReference();
        GoPackageReference elementReference = qualifiedElement.getPackageReference();

        GoLiteralString importPath = importSpec.getImportPath();
        if (importPath == null )
            return false;

        // import "a"; var x a.T;
        if (importedPackageReference == null && elementReference != null
            && elementReference.getString().equals(findDefaultPackageName(importPath.getValue()))) {
            return true;
        }

        // import . "a"; var x T; // T is defined inside package a
        if ( importedPackageReference != null && importedPackageReference.isLocal() && elementReference == 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.