static GoStringLiteral getEnvironmentGoLiteral()

in go/src/ru/adelf/idea/dotenv/go/GoPsiHelper.java [27:49]


    static GoStringLiteral getEnvironmentGoLiteral(GoCallExpr callExpression) {
        GoReferenceExpression ref = GoPsiUtil.getCallReference(callExpression);
        if (ref == null) return null;

        /*String functionName = StringUtil.toLowerCase(ref.getIdentifier().getText());
        if (!ENV_FUNCTIONS.containsKey(functionName)) return false;

        PsiElement resolve = ref.resolve();
        GoFunctionOrMethodDeclaration declaration = ObjectUtils.tryCast(resolve, GoFunctionOrMethodDeclaration.class);
        if (!GoInspectionUtil.isInSdkPackage(declaration, "os")) return false;*/

        String functionName = ref.getText().toLowerCase();

        if (!ENV_FUNCTIONS.containsKey(functionName)) return null;

        int position = ENV_FUNCTIONS.get(functionName);
        if (callExpression.getArgumentList().getExpressionList().size() < position + 1) return null;

        GoExpression expr = callExpression.getArgumentList().getExpressionList().get(position);
        if (!(expr instanceof GoStringLiteral)) return null;

        return (GoStringLiteral) expr;
    }