Code review comment: array is generated for rest binding pattern in list binding pattern. For error and mapping bp it generates a map for rest bp. So to be generalized I removed array word

Code under review:
private List<BLangVariable> desugarGlobalVariables(BLangPackage pkgNode, BLangBlockFunctionBody initFnBody) {
        List<BLangVariable> globalVars = pkgNode.globalVars;
        List<BLangVariable> desugaredGlobalVarList = new ArrayList<>();
        SymbolEnv initFunctionEnv =
                SymbolEnv.createFunctionEnv(pkgNode.initFunction, pkgNode.initFunction.symbol.scope, env);

        globalVars.forEach(globalVar -> {
            this.env.enclPkg.topLevelNodes.remove(globalVar);
            
            switch (globalVar.getKind()) {
                case TUPLE_VARIABLE:
                case RECORD_VARIABLE:
                case ERROR_VARIABLE:
                    BLangNode blockStatementNode = rewrite(globalVar, initFunctionEnv);
                    List<BLangStatement> statements = ((BLangBlockStmt) blockStatementNode).stmts;
                    for (int i = 0; i < statements.size(); i++) {
                        BLangStatement bLangStatement = statements.get(i);
                        
                        
                        if (bLangStatement.getKind() == NodeKind.BLOCK || i == 0) {
                            initFnBody.stmts.add(bLangStatement);
                            continue;
                        }
                        BLangSimpleVariable simpleVar = ((BLangSimpleVariableDef) bLangStatement).var;
                        simpleVar.annAttachments = globalVar.getAnnotationAttachments();
                        addToInitFunction(simpleVar, initFnBody);
                        desugaredGlobalVarList.add(simpleVar);
                    }
                    break;
                default:
                    long globalVarFlags = globalVar.symbol.flags;
                    BLangSimpleVariable simpleGlobalVar = (BLangSimpleVariable) globalVar;
                    if (Symbols.isFlagOn(globalVarFlags, Flags.CONFIGURABLE)) {
                        if (Symbols.isFlagOn(globalVarFlags, Flags.REQUIRED)) {
                            
                            List<BLangExpression> args = getConfigurableLangLibInvocationParam(simpleGlobalVar);
                            BLangInvocation getValueInvocation = createLangLibInvocationNode("getConfigurableValue",
                                    args, symTable.anydataType, simpleGlobalVar.pos);
                            simpleGlobalVar.expr = getValueInvocation;
                        } else {
                            
                            simpleGlobalVar.expr = createIfElseFromConfigurable(simpleGlobalVar);
                        }
                    }

                    
                    if (Symbols.isFlagOn(globalVarFlags, Flags.LISTENER)
                            && types.containsErrorType(globalVar.expr.type)) {
                        globalVar.expr = ASTBuilderUtil.createCheckExpr(globalVar.expr.pos, globalVar.expr,
                                globalVar.type);
                    }

                    addToInitFunction(simpleGlobalVar, initFnBody);
                    desugaredGlobalVarList.add(simpleGlobalVar);
                    break;
            }
        });
        this.env.enclPkg.topLevelNodes.addAll(desugaredGlobalVarList);
        return desugaredGlobalVarList;
    }


Revised code:
private List<BLangVariable> desugarGlobalVariables(BLangPackage pkgNode, BLangBlockFunctionBody initFnBody) {
        List<BLangVariable> desugaredGlobalVarList = new ArrayList<>();
        SymbolEnv initFunctionEnv =
                SymbolEnv.createFunctionEnv(pkgNode.initFunction, pkgNode.initFunction.symbol.scope, env);

        for (BLangVariable globalVar : pkgNode.globalVars) {
            this.env.enclPkg.topLevelNodes.remove(globalVar);
            
            switch (globalVar.getKind()) {
                case TUPLE_VARIABLE:
                    BLangNode blockStatementNode = rewrite(globalVar, initFunctionEnv);
                    List<BLangStatement> statements = ((BLangBlockStmt) blockStatementNode).stmts;

                    int statementSize = statements.size();
                    for (int i = 0; i < statementSize - 1; i++) {
                        addToGlobalVariableList(statements.get(i), initFnBody, globalVar, desugaredGlobalVarList);
                    }

                    
                    BLangStatement bLangStatement = statements.get(statementSize - 1);
                    if (bLangStatement.getKind() == NodeKind.BLOCK) {
                        initFnBody.stmts.add(bLangStatement);
                    } else {
                        addToGlobalVariableList(bLangStatement, initFnBody, globalVar, desugaredGlobalVarList);
                    }
                    break;
                case RECORD_VARIABLE:
                case ERROR_VARIABLE:
                    blockStatementNode = rewrite(globalVar, initFunctionEnv);
                    for (BLangStatement statement : ((BLangBlockStmt) blockStatementNode).stmts) {
                        addToGlobalVariableList(statement, initFnBody, globalVar, desugaredGlobalVarList);
                    }
                    break;
                default:
                    long globalVarFlags = globalVar.symbol.flags;
                    BLangSimpleVariable simpleGlobalVar = (BLangSimpleVariable) globalVar;
                    if (Symbols.isFlagOn(globalVarFlags, Flags.CONFIGURABLE)) {
                        if (Symbols.isFlagOn(globalVarFlags, Flags.REQUIRED)) {
                            
                            List<BLangExpression> args = getConfigurableLangLibInvocationParam(simpleGlobalVar);
                            BLangInvocation getValueInvocation = createLangLibInvocationNode("getConfigurableValue",
                                    args, symTable.anydataType, simpleGlobalVar.pos);
                            simpleGlobalVar.expr = getValueInvocation;
                        } else {
                            
                            simpleGlobalVar.expr = createIfElseFromConfigurable(simpleGlobalVar);
                        }
                    }

                    
                    if (Symbols.isFlagOn(globalVarFlags, Flags.LISTENER)
                            && types.containsErrorType(globalVar.expr.type)) {
                        globalVar.expr = ASTBuilderUtil.createCheckExpr(globalVar.expr.pos, globalVar.expr,
                                globalVar.type);
                    }

                    addToInitFunction(simpleGlobalVar, initFnBody);
                    desugaredGlobalVarList.add(simpleGlobalVar);
                    break;
            }
        }

        this.env.enclPkg.topLevelNodes.addAll(desugaredGlobalVarList);
        return desugaredGlobalVarList;
    }