Method not working in 4.0, was ok with 3 and 3.5

I have a global method (function) that worked fine in Servoy 3 and 3.5 up to and including 3.5.6 but now it throws an error in Servoy 4.0

This is the message I receive

TypeError: gb_mt_sqlOperator is not a function, it is com.servoy.j2db.persistence.ScriptMethod. (/Users/rioba/Servoy/Projects/newspapers/forms/fm_search_infra/fm_search_infra_methods.js#169)

org.mozilla.javascript.EcmaError: TypeError: gb_mt_sqlOperator is not a function, it is com.servoy.j2db.persistence.ScriptMethod. (/Users/rioba/Servoy/Projects/newspapers/forms/fm_search_infra/fm_search_infra_methods.js#169)

I don’t understand what “is not a function … it is … ScriptMethod” means.

UPDATE

There was an error in a regular expression (I put one unnecessary parenthesis) inside the method/function. After correcting this, the function is working ok.

It is strange that it always worked in 3.5, probably because that RegExp was never evaluated (it was meant to correct a very rare situation that eventually never appeared). But in Servoy 4.0 this function always throws an error before it is executed, doesn’t matter if that particular event is produced or not. This is why I could not debug the function.

hmm it could be that the reg exp is now compiled directly with the javascript code… So i guess if the reg exp is bad the compiler cant compile it at all anymore.

i guess this is because of an optimization in the new javascript engine.