Page 1 of 1

2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Tue Jun 07, 2022 11:24 am
by briese-it
I upgraded to 2021.3.3.3645_LTS and now the constructors have warnings.
For example the mod_dialogs "globals.DIALOGS.showErrorDialog()". Seems that Servoy doesn't recognizes the return values. Is this a bug or do I need to adjust the code?

Code: Select all

var DIALOGS = new function() {
/**
    * Show an error dialog
    *
    * @param {String} title
    * @param {String} message
    * @param {...String} buttons
    * @return {String}
    *
    * @SuppressWarnings(wrongparameters)
    */
   this.showErrorDialog = function(title, message, buttons) {
      if (application.getApplicationType() == APPLICATION_TYPES.NG_CLIENT) {
         return plugins.dialogs.showErrorDialog(title, message, getButtons(arguments));
      }
      return showDialog('dialogs_message', 'error', arguments, 'dialogs_icon_error');
   }
}

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Tue Jun 07, 2022 11:38 am
by jcompagner
upgraded from which release?

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Tue Jun 07, 2022 12:29 pm
by briese-it
Servoy 2020.03.3 LTS

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Tue Jun 07, 2022 12:40 pm
by jcompagner
i guess you didn't put the full source in right (so the js doc above that)

https://www.servoyforge.net/projects/mo ... bals.js#L2

because that should be ok because there is a @constructor (or @parse)

see the release notes of 2020.06:

https://wiki.servoy.com/display/DOCS/2020.06+Whats+new

"All these changes in the ScriptBuilder did result in that we needed to drop the "none shallow parsing" mode that we still had as an option in the preferences.
This option is removed and now the your javascript files are always build in shallow parsing mode, this means that having @param and especially @return is quite important to have (besides @constructor and @parse for functions that needs to be fully parsed anyway)"

so things like that (globals.DIALOGS) must be marked as @parse (or @constructor)
then i think it should be fine

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Tue Jun 07, 2022 1:04 pm
by briese-it
I see but it was only a code snipped and the JSDoc looks fine:

Code: Select all
/**
* @constructor
*
* @description Dialog module - https://www.servoyforge.net/projects/mod-dialog
* @version 1.1.5
*
* Written by Robert J.C. Ivens and Paul Bakker
* OS dependent button-reverse patch by Harjo Kompagnie
*
* @properties={typeid:35,uuid:"EFF9564C-DBDB-4087-A9DF-A56826FE2CC7",variableType:-4}
*/
var DIALOGS = new function() {...

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Wed Jun 08, 2022 12:46 pm
by briese-it
Any other ideas?

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Wed Jun 08, 2022 1:41 pm
by mboegem
I've also seen this in my solutions.
Haven't tried yet, but it could be that @constructor only works on functions, not on variables defined as functions.

Just out of interest: are you using the dialog module because you are still running a web-client solution?
NG/Titanium client would not require this anymore as there is a direct replacement for the dialogs plugin. :D

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Wed Jun 08, 2022 1:50 pm
by briese-it
Yes, Iam using Smart/Webclient. My solution is that big (abt. 150 modules) that there is currenctly no time to switch to NG.

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Tue Jun 14, 2022 4:48 pm
by briese-it
It seems that there is a bug regarding scopes. I created a test constructor:

1. Call the constructor with scopes.... gives warnings. No code completion

2. Call the constructor directly: Everything fine. Code completion works

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Tue Jun 14, 2022 5:14 pm
by jcompagner
you now tell it that it needs to parse the variable (or see the variable as a constructor) but that is not what it needs to parse:

Code: Select all
var check = new /** @constructor */ function() {
   this.updateRecord = function() {
      
   }
}

Re: 2021.3.3.3645_LTS Constructor Object undefined

PostPosted: Wed Jun 15, 2022 7:56 am
by briese-it
Hi Johan,
Thanks for the clarification. That also fixed my problem for the mod_dialog. Perfect.