Skip to content
This repository has been archived by the owner on Sep 25, 2018. It is now read-only.

foreach fails in strict mode due to undeclared shallow array name variable #369

Open
mattoshry opened this issue Jun 9, 2016 · 0 comments

Comments

@mattoshry
Copy link
Collaborator

This crops up when the app that hosts scion is run in use strict mode.

<datamodel>
  <data id="arr" expr="[10, 20, 30]"/>
  <data id="current"/>
  <data id="idx"/>
</datamodel>
 <foreach array="arr" item="current" index="idx">
        <log expr="'current: ' + current + ', idx: ' + idx" label="TEST"/>
 </foreach>
$scionArray_31 is not defined

The issue is here:

shallowArrayName + ' = ' + arr + ';\n'+

A fix:

         var forEachContents =
-            shallowArrayName + ' = ' + arr + ';\n'+
+            'var ' + shallowArrayName + ' = ' + arr + ';\n'+
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant