You found a bug! We've classified it as DSGNR-4771 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    68
    Vote Rating
    0
    dnoizet is on a distinguished road

      0  

    Default Opening braces can't find their closing braces in large functions

    Opening braces can't find their closing braces in large functions


    I've noticed that in most of my big functions, the closing brace can't find its opening brace.
    I've made sure that the code is correct, that no semi-colon are missing, etc.
    I've tried cutting/pasting the code, my usual fix when error detection is messed up.

    You can copy and paste this code snippet into a Basic Function in Sencha Architect to see the bug (I know the code doesn't make sense, I've stripped a lot of code to demonstrate the bug):


    If you delete some random code blocks, you will see that the braces become okay.

    Code:
    if( salarie && mois )
    { // <-- this brace appears in red
    
        //récupération de l'enregistrement du salarié
        var rec_sal = cbo_suivi_salarie.findRecordByValue( salarie );
    
        //récupération du sad_cle
        var sad_cle = store_salaries.proxy.extraParams.search;
    
        //récupération de l'enregistrement de la semaine courante
        var rec_sem = store_semaines.findRecord( "SEM_ID", num_sem );
    
        //récupération du premier jour du mois
        var rec_mois = cbo_suivi_mois.findRecordByValue( mois );
    
    
        //si tout est OK alors
        if( sad_cle && num_sem && rec_sal && rec_sem && rec_mois )
        { // <-- this brace appears in red also
            if( caller != "horaires_social_onJsonstoreWrite" )
            {
    
            }
    
            if( caller != "horaires_social_onJsonstoreWrite" &&
               caller != "onBtn_suivi_semaine_xToggle" )
            {
    
            }
    
            if( caller != "onBtn_suivi_semaine_xToggle" )
            {
     
            }
            
            // Teste si c'est déjà commandé. Si oui, on n'autorise pas la saisie.              
            if( caller != "horaires_social_onJsonstoreWrite" && caller != "onBtn_suivi_semaine_xToggle" )
            {
                //requête
                Ext.Ajax.request(
                {
                    "url": "/service/test_commande_read",
                    "params":
                    {
                        "role":  "A",
                        "sad":   sad_cle,
                        "sal":   sal_id,
                        "cos":   cos_id,
                        "mois":  in_mois,
                        "annee": in_annee
                    },
                    "success": function( response, options )
                    {          
                        // process server response here
                        var jsonresponse = Ext.JSON.decode( response.responseText, true );
                        if( jsonresponse )
                        {
                            if( jsonresponse.success )
                            {
                                //pas de blocage, on autorise la saisie
                                btn_suivi_commander.enable();
                                grid_suivi_donnees_hebdomadaires_view.enable();
                                grid_suivi_donnees_journalieres_view.enable();
                                grid_suivi_synthese_view.enable();
    
                                form_suivi_donnees_mensuelles.items.items.forEach( function( item, index, all )
                                {
                                    if( item.items )
                                    {
                                        item.items.items.forEach( function( item2, index2, all2 )
                                        {
                                            item2.enable();
                                        });
                                    }
                                    else
                                    {
                                        item.enable();
                                    }
                                });
    
                                lbl_suivi_erreur.setValue( "&nbsp;" );
                            }
                            else
                            {
                                //déjà commandé, on n'autorise pas la saisie
                                btn_suivi_commander.disable();
                                grid_suivi_donnees_hebdomadaires_view.disable();                                               
                                grid_suivi_donnees_journalieres_view.disable();                                               
                                grid_suivi_synthese_view.disable();                                               
    
                                form_suivi_donnees_mensuelles.items.items.forEach( function( item, index, all )
                                {
                                    if( item.items )
                                    {
                                        item.items.items.forEach( function( item2, index2, all2 )
                                        {
                                            item2.disable();
                                        });
                                    }
                                    else
                                    {
                                        item.disable();
                                    }
                                });
    
                                lbl_suivi_erreur.setValue( jsonresponse.message );
                            }
                        }
                        else
                        { 
                            alert( "Erreur inconnue ! (2)" );
                        }
                    },
                    "failure": function( response, options )
                    {
                        alert( "Erreur inconnue ! (1)" );
                    },
                    "scope": this
                });
            }
        }// <-- this brace appears in red also
     }// <-- this brace appears in red
    Last edited by dnoizet; 15 Oct 2013 at 7:30 AM. Reason: spelling

  2. #2
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    68
    Vote Rating
    0
    dnoizet is on a distinguished road

      0  

    Default


    The following code has been tweaked to pass the tests in jslint.com, but still demonstrate the same behavior:

    Code:
    /*jslint ass: true, bitwise: true, eqeq: true, plusplus: true, unparam: true, sloppy: true, stupid: true, sub: true, vars: true, white: true */
    
    var salarie, mois, caller, cbo_suivi_salarie, store_salaries, store_semaines, num_sem, cbo_suivi_mois, Ext, sal_id, cos_id, in_mois, in_annee, btn_suivi_commander;
    var grid_suivi_donnees_hebdomadaires_view,grid_suivi_donnees_journalieres_view, grid_suivi_synthese_view, form_suivi_donnees_mensuelles, lbl_suivi_erreur;
    var alert;
    
    if( salarie && mois )
    { // <-- this brace appears in red
    
        //récupération de l'enregistrement du salarié
        var rec_sal = cbo_suivi_salarie.findRecordByValue( salarie );
    
        //récupération du sad_cle
        var sad_cle = store_salaries.proxy.extraParams.search;
    
        //récupération de l'enregistrement de la semaine courante
        var rec_sem = store_semaines.findRecord( "SEM_ID", num_sem );
    
        //récupération du premier jour du mois
        var rec_mois = cbo_suivi_mois.findRecordByValue( mois );
    
    
        //si tout est OK alors
        if( sad_cle && num_sem && rec_sal && rec_sem && rec_mois )
        { // <-- this brace appears in red also
            if( caller != "horaires_social_onJsonstoreWrite" )
            {
               var test;
            }
    
            if( caller != "horaires_social_onJsonstoreWrite" &&
               caller != "onBtn_suivi_semaine_xToggle" )
            {
               var test2;
            }
    
            if( caller != "onBtn_suivi_semaine_xToggle" )
            {
                var test3;
            }
            
            // Teste si c'est déjà commandé. Si oui, on n'autorise pas la saisie.              
            if( caller != "horaires_social_onJsonstoreWrite" && caller != "onBtn_suivi_semaine_xToggle" )
            {
                //requête
                Ext.Ajax.request(
                {
                    "url": "/service/test_commande_read",
                    "params":
                    {
                        "role":  "A",
                        "sad":   sad_cle,
                        "sal":   sal_id,
                        "cos":   cos_id,
                        "mois":  in_mois,
                        "annee": in_annee
                    },
                    "success": function( response, options )
                    {          
                        // process server response here
                        var jsonresponse = Ext.JSON.decode( response.responseText, true );
                        if( jsonresponse )
                        {
                            if( jsonresponse.success )
                            {
                                //pas de blocage, on autorise la saisie
                                btn_suivi_commander.enable();
                                grid_suivi_donnees_hebdomadaires_view.enable();
                                grid_suivi_donnees_journalieres_view.enable();
                                grid_suivi_synthese_view.enable();
    
                                form_suivi_donnees_mensuelles.items.items.forEach( function( item, index, all )
                                {
                                    if( item.items )
                                    {
                                        item.items.items.forEach( function( item2, index2, all2 )
                                        {
                                            item2.enable();
                                        });
                                    }
                                    else
                                    {
                                        item.enable();
                                    }
                                });
    
                                lbl_suivi_erreur.setValue( "&nbsp;" );
                            }
                            else
                            {
                                //déjà commandé, on n'autorise pas la saisie
                                btn_suivi_commander.disable();
                                grid_suivi_donnees_hebdomadaires_view.disable();                                               
                                grid_suivi_donnees_journalieres_view.disable();                                               
                                grid_suivi_synthese_view.disable();                                               
    
                                form_suivi_donnees_mensuelles.items.items.forEach( function( item, index, all )
                                {
                                    if( item.items )
                                    {
                                        item.items.items.forEach( function( item2, index2, all2 )
                                        {
                                            item2.disable();
                                        });
                                    }
                                    else
                                    {
                                        item.disable();
                                    }
                                });
    
                                lbl_suivi_erreur.setValue( jsonresponse.message );
                            }
                        }
                        else
                        { 
                            alert( "Erreur inconnue ! (2)" );
                        }
                    },
                    "failure": function( response, options )
                    {
                        alert( "Erreur inconnue ! (1)" );
                    },
                    "scope": this
                });
            }
        }// <-- this brace appears in red also
    }// <-- this brace appears in red

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    14
    Vote Rating
    0
    pcki11 is on a distinguished road

      0  

    Default


    You can mostly ignore red braces and exclamation marks in Architect, because it was buggy since forever. Although for some of the exclamation marks cutting all and pasting back removes false error notifications.

  4. #4
    Sencha Premium Member dnoizet's Avatar
    Join Date
    Aug 2012
    Posts
    68
    Vote Rating
    0
    dnoizet is on a distinguished road

      0  

    Default


    When I see some exclamation marks, I cut-paste the code and only the real errors remains. That's obviously another bug, but it doesn't bother me that much.

    As for the braces, I find it quite useful to know which brace you are closing in a language such as JavaScript with nested functions and objects. When I see a red brace, I often search for a few minutes what is going on, only to find out later that my code is correct. So that would be awesome if that could be fixed.
    Last edited by dnoizet; 21 Oct 2013 at 11:08 PM. Reason: spelling

  5. #5
    Sencha - Architect Dev Team jjohnston's Avatar
    Join Date
    Sep 2010
    Posts
    423
    Vote Rating
    15
    jjohnston will become famous soon enough jjohnston will become famous soon enough

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar