Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1637

ES6 code frame fails when using duplicate variable declarations

    Details

    • Sprint:
      2018 Sprint 23

      Description

      When using ES6 constants and accidentially redeclaring them like in the following example:

      {code.js}

      const test = '';
      const test = 'hello';

      the build fails like expected, but the error is hidden by a parsing error inside our code-frame / ES6 transform handling:
      

      [DEBUG] /usr/local/lib/node_modules/alloy/Alloy/commands/compile/ast/controller.js:66
      [DEBUG] U.dieWithCodeFrame('Error generating AST for "' + file + '". Unexpected token at line ' + e.loc.line + ' column ' + e.loc.column, e.loc, code);
      [DEBUG] ^
      [DEBUG] TypeError: Cannot read property 'line' of undefined
      [DEBUG] at Object.exports.processController (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/ast/controller.js:66:99)
      [DEBUG] at Object.exports.loadController (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:929:33)
      [DEBUG] at parseAlloyComponent (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:833:17)

       

      This is no critical error, but reaaally hard to track if never happened before. I hope this JIRA also helps some people tracking it down more easily.

        Attachments

          Activity

            People

            • Assignee:
              fmiao Feon Sua Xin Miao
              Reporter:
              hknoechel Hans Knöchel
              Tester:
              Ewan Harris
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Alloy <> Alloy
                  Synced with:
                  ALOY-4
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration