Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1637] ES6 code frame fails when using duplicate variable declarations

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2019-01-11T11:51:31.000+0000
Affected Version/sn/a
Fix Version/sCLI Release 7.0.10, Alloy 1.13.8
ComponentsTooling
Labelsn/a
ReporterHans Knöchel
AssigneeFeon Sua Xin Miao
Created2018-11-06T09:08:55.000+0000
Updated2019-02-18T11:46:46.000+0000

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.

Comments

  1. Ewan Harris 2019-01-11

    This is merged but not published. Will publish alongside ALOY-1640 and ALOY-1639
  2. Lokesh Choudhary 2019-01-16

    Verified the fix in CLI 7.0.10-master.5 with alloy 1.13.7. Closing. Studio Ver: 5.1.2.201812191831 OS Ver: 10.14 Xcode Ver: Xcode 10.1 Appc NPM: 4.2.13 Appc CLI: 7.0.10-master.5 Daemon Ver: 1.1.3 Ti CLI Ver: 5.1.1 Alloy Ver: 1.13.7 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 10.0.2

JSON Source