Assume, you have an Action Script like this:
local myVar = ''
local myVar = myObject.stringAttribute if myObject.stringAttribute.exists();
myVar is a String variable that is declared twice in the Action Script. It is initialized with “empty string”. In a second step, this initial value is overwritten by a string attribute, if existing.
myVar contains an empty string.
The initial value of
myValue is preserved, if the condition of the second statement evaluates to false.
If the condition of the second statement evaluates to false, contents of
myVar are set to
Reason for this is that we now transform
local a = b if c; to
local a = condition(c, b, null);. The old behavior caused problems with wrong variable initialization in iterations.
Using BUILDER 6.0.28 may have severe consequences, as affected variables may become NULL. This can have unexpected side effects that only are revealed at runtime and are hard to find.
Re-declaring a local variable is no good practice. In case the Compiler points you to a implementation like this, you should replace the second (or more)
[create] local statements by a
local myVar = '';
set myVar = myObject.stringAttribute if myObject.stringAttribute.exists();
If you have BUILDER 6.0.28 installed, we strongly recommend to update to BUILDER 18.104.22.168. Only this BUILDER version will point you to the critical statements.
To be sure to find all of them, perform a Clean all on your BUILDER project (see Menu Overview of the E2E Model Compiler).
You must be logged in to reply to this topic.