{ "id": "171761", "key": "ALOY-1623", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2018-06-07T16:02:53.000+0000", "priority": null, "labels": [ "regression" ], "versions": [], "issuelinks": [], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2018-06-20T13:38:08.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "13605", "name": "Models" } ], "description": "When building an Alloy project which uses deep link data binding the build will fail during the Alloy compilation step.\r\n\r\nConsole Output:\r\n{noformat}\r\n[INFO] : ----- MVC GENERATION -----\r\n[INFO] : [global style] loading from cache...\r\n[INFO] : [models/book.js] model processing...\r\n[INFO] : [index.xml] view processing...\r\n[INFO] : style: \"index.tss\"\r\n[INFO] : view: \"index.xml\"\r\n[INFO] : controller: \"index.js\"\r\n[INFO] : created: \"Resources/android/alloy/controllers/index.js\"\r\n[INFO] : created: \"Resources/android/alloy/styles/index.js\"\r\n[INFO] : [test.xml] view processing...\r\n[INFO] : style: \"test.tss\"\r\n[INFO] : view: \"test.xml\"\r\n[INFO] : controller: \"test.js\"\r\n[DEBUG] : \tBackbone = Alloy.Backbone,\r\n[DEBUG] : \t_ = Alloy._;\r\n[DEBUG] : function __processArg(obj, key) {\r\n[DEBUG] : \tvar arg = null;\r\n[DEBUG] : \tif (obj) {\r\n[DEBUG] : \t\targ = obj[key] || null;\r\n[DEBUG] : \t}\r\n[DEBUG] : \treturn arg;\r\n[DEBUG] : }\r\n[DEBUG] : function Controller() {\r\n[DEBUG] : \t\r\n[DEBUG] : \trequire('/alloy/controllers/' + 'BaseController').apply(this, Array.prototype.slice.call(arguments));\r\n[DEBUG] : \tthis.__controllerPath = 'test';\r\n[DEBUG] : \tthis.args = arguments[0] || {};\r\n[DEBUG] : \tif (arguments[0]) {\r\n[DEBUG] : \t\tvar __parentSymbol = __processArg(arguments[0], '__parentSymbol');\r\n[DEBUG] : \t\tvar $model = __processArg(arguments[0], '$model');\r\n[DEBUG] : \t\tvar __itemTemplate = __processArg(arguments[0], '__itemTemplate');\r\n[DEBUG] : \t}\r\n[DEBUG] : \tvar $ = this;\r\n[DEBUG] : \tvar exports = {};\r\n[DEBUG] : \tvar __defers = {};\r\n[DEBUG] : \t// Generated code that must be executed before all UI and/or\r\n[DEBUG] : \t// controller code. One example is all model and collection\r\n[DEBUG] : \t// declarations from markup.\r\n[DEBUG] : \t$.Books = Alloy.createCollection('book');$.Book = Alloy.createModel('book');\r\n[DEBUG] : \t// Generated UI code\r\n[DEBUG] : \t$.__views.test = Ti.UI.createWindow(\r\n[DEBUG] : {id:\"test\",}\r\n[DEBUG] : );\r\n[DEBUG] : $.__views.test && $.addTopLevelView($.__views.test);\r\n[DEBUG] : var __alloyId1={};var __alloyId4=[];var __alloyId6={type:'Ti.UI.Label',bindId:'bookLbl',properties:{bindId:\"bookLbl\",},};__alloyId4.push(__alloyId6);var __alloyId3 = {properties:{name:\"book\",},childTemplates:__alloyId4,};__alloyId1[\"book\"]=__alloyId3;$.__views.__alloyId10 = Ti.UI.createLabel(\r\n[DEBUG] : {text:'Collection Binding',id:\"__alloyId10\",}\r\n[DEBUG] : );\r\n[DEBUG] : $.__views.__alloyId7 = Ti.UI.createListSection(\r\n[DEBUG] : {headerView:$.__views.__alloyId10,id:\"__alloyId7\",}\r\n[DEBUG] : );\r\n[DEBUG] : var __alloyId14=Alloy.Collections['$.Books'] || $.Books;function __alloyId15(e) { if (e && e.fromAdapter) { return; } var opts = __alloyId15.opts || {};\tvar models = __alloyId14.models;\tvar len = models.length;var __alloyId8=[];\tfor (var i = 0; i < len; i++) {\t\tvar __alloyId11 = models[i];\t\t__alloyId11.__transform = _.isFunction(__alloyId11.transform)?__alloyId11.transform():__alloyId11.toJSON();var __alloyId13 = {bookLbl:{text:__alloyId11.__transform.title + ' by ' + __alloyId11.__transform.author,},template:\"book\",};__alloyId8.push(__alloyId13);\t}opts.animation ? $.__views.__alloyId7.setItems(__alloyId8, opts.animation) : $.__views.__alloyId7.setItems(__alloyId8);};__alloyId14.on('fetch destroy change add remove reset',__alloyId15);var __alloyId16=[];__alloyId16.push($.__views.__alloyId7);$.__views.__alloyId20 = Ti.UI.createLabel(\r\n[DEBUG] : {text:'Model Binding',id:\"__alloyId20\",}\r\n[DEBUG] : );\r\n[DEBUG] : var __alloyId21=[];$.__views.__alloyId22 = {template:\"book\",properties:{id:\"__alloyId22\",},};__alloyId21.push($.__views.__alloyId22);$.__views.__alloyId17 = Ti.UI.createListSection(\r\n[DEBUG] : {headerView:$.__views.__alloyId20,id:\"__alloyId17\",}\r\n[DEBUG] : );\r\n[DEBUG] : $.__views.__alloyId17.items=__alloyId21;__alloyId16.push($.__views.__alloyId17);$.__views.__alloyId0 = Ti.UI.createListView(\r\n[DEBUG] : {sections:__alloyId16,templates:__alloyId1,id:\"__alloyId0\",}\r\n[DEBUG] : );\r\n[DEBUG] : $.__views.test.add($.__views.__alloyId0);\r\n[DEBUG] : var __alloyId23 = function() {$['Book'].__transform = _.isFunction($['Book'].transform) ? $['Book'].transform() : $['Book'].toJSON();$.__alloyId22.bookLbl:text = $['Book']['__transform']['title'];};$['Book'].on('fetch change destroy',__alloyId23);exports.destroy = function () {__alloyId14 && __alloyId14.off('fetch destroy change add remove reset',__alloyId15);$['Book'] && $['Book'].off('fetch change destroy',__alloyId23);};\r\n[DEBUG] : \t// make all IDed elements in $.__views available right on the $ in a\r\n[DEBUG] : \t// controller's internal code. Externally the IDed elements will\r\n[DEBUG] : \t// be accessed with getView().\r\n[DEBUG] : \t_.extend($, $.__views);\r\n[DEBUG] : \t// Controller code directly from the developer's controller file\r\n[DEBUG] : // Arguments passed into this controller can be accessed via the `$.args` object directly or:\r\n[DEBUG] : var args = $.args;\r\n[DEBUG] : \t// Generated code that must be executed after all UI and\r\n[DEBUG] : \t// controller code. One example deferred event handlers whose\r\n[DEBUG] : \t// functions are not defined until after the controller code\r\n[DEBUG] : \t// is executed.\r\n[DEBUG] : \t\r\n[DEBUG] : \t// Extend the $ instance with all functions and properties\r\n[DEBUG] : \t// defined on the exports object.\r\n[DEBUG] : \t_.extend($, exports);\r\n[DEBUG] : }\r\n[DEBUG] : module.exports = Controller;\r\n[DEBUG] : /Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/Alloy/commands/compile/sourceMapper.js:97\r\n[DEBUG] : \t\tthrow e;\r\n[DEBUG] : \t\t^\r\n[DEBUG] : SyntaxError: Unexpected token, expected ; (57:154)\r\n[DEBUG] : at Parser.pp$5.raise (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:4454:13)\r\n[DEBUG] : at Parser.pp.unexpected (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:1761:8)\r\n[DEBUG] : at Parser.pp.semicolon (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:1742:38)\r\n[DEBUG] : at Parser.pp$1.parseExpressionStatement (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2236:8)\r\n[DEBUG] : at Parser.pp$1.parseStatement (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:1911:17)\r\n[DEBUG] : at Parser.pp$1.parseBlockBody (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2268:21)\r\n[DEBUG] : at Parser.pp$1.parseBlock (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2247:8)\r\n[DEBUG] : at Parser.pp$3.parseFunctionBody (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:4235:22)\r\n[DEBUG] : at Parser.pp$1.parseFunction (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2386:8)\r\n[DEBUG] : at Parser.pp$3.parseFunctionExpression (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:3760:17)\r\n[DEBUG] : at Parser.pp$3.parseExprAtom (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:3722:19)\r\n[DEBUG] : at Parser.pp$3.parseExprSubscripts (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:3494:19)\r\n[DEBUG] : at Parser.pp$3.parseMaybeUnary (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:3474:19)\r\n[DEBUG] : at Parser.pp$3.parseExprOps (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:3404:19)\r\n[DEBUG] : at Parser.pp$3.parseMaybeConditional (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:3381:19)\r\n[DEBUG] : at Parser.pp$3.parseMaybeAssign (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:3344:19)\r\n[DEBUG] : at Parser.pp$1.parseVar (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2340:24)\r\n[DEBUG] : at Parser.pp$1.parseVarStatement (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2169:8)\r\n[DEBUG] : at Parser.pp$1.parseStatement (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:1861:19)\r\n[DEBUG] : at Parser.pp$1.parseBlockBody (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2268:21)\r\n[DEBUG] : at Parser.pp$1.parseBlock (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2247:8)\r\n[DEBUG] : at Parser.pp$3.parseFunctionBody (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:4235:22)\r\n[DEBUG] : at Parser.pp$1.parseFunction (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2386:8)\r\n[DEBUG] : at Parser.pp$1.parseFunctionStatement (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2053:15)\r\n[DEBUG] : at Parser.pp$1.parseStatement (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:1839:19)\r\n[DEBUG] : at Parser.pp$1.parseBlockBody (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:2268:21)\r\n[DEBUG] : at Parser.pp$1.parseTopLevel (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:1778:8)\r\n[DEBUG] : at Parser.parse (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:1673:17)\r\n[DEBUG] : at Object.parse (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/babylon/lib/index.js:7305:37)\r\n[DEBUG] : at Object.exports.generateCodeAndSourceMap (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/Alloy/commands/compile/sourceMapper.js:91:17)\r\n[DEBUG] : at parseAlloyComponent (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/Alloy/commands/compile/index.js:943:15)\r\n[DEBUG] : at /Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/Alloy/commands/compile/index.js:450:6\r\n[DEBUG] : at arrayEach (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/lodash/lodash.js:516:11)\r\n[DEBUG] : at Function.forEach (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/lodash/lodash.js:9342:14)\r\n[DEBUG] : at /Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/Alloy/commands/compile/index.js:439:6\r\n[DEBUG] : at arrayEach (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/lodash/lodash.js:516:11)\r\n[DEBUG] : at Function.forEach (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/node_modules/lodash/lodash.js:9342:14)\r\n[DEBUG] : at module.exports (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/Alloy/commands/compile/index.js:435:4)\r\n[DEBUG] : at Object. (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/Alloy/alloy.js:112:46)\r\n[DEBUG] : at Module._compile (module.js:635:30)\r\n[DEBUG] : at Object.Module._extensions..js (module.js:646:10)\r\n[DEBUG] : at Module.load (module.js:554:32)\r\n[DEBUG] : at tryModuleLoad (module.js:497:12)\r\n[DEBUG] : at Function.Module._load (module.js:489:3)\r\n[DEBUG] : at Module.require (module.js:579:17)\r\n[DEBUG] : at require (internal/module.js:11:18)\r\n[DEBUG] : at Object. (/Users/macdev/.appcelerator/install/7.0.3/package/node_modules/alloy/bin/alloy:3:1)\r\n[DEBUG] : at Module._compile (module.js:635:30)\r\n[DEBUG] : at Object.Module._extensions..js (module.js:646:10)\r\n[DEBUG] : at Module.load (module.js:554:32)\r\n[DEBUG] : at tryModuleLoad (module.js:497:12)\r\n[DEBUG] : at Function.Module._load (module.js:489:3)\r\n[DEBUG] : at Function.Module.runMain (module.js:676:10)\r\n[DEBUG] : at startup (bootstrap_node.js:187:16)\r\n[DEBUG] : at bootstrap_node.js:608:3\r\n[ERROR] : Alloy compiler failed\r\n[ERROR] Application Installer abnormal process termination. Process exit value was 1\r\n{noformat}\r\n\r\ntest.xml:\r\n{code:xml}\r\n\r\n\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nbook.js:\r\n{code:javascript}\r\nexports.definition = {\r\n\tconfig: {\r\n\t\tcolumns: {\r\n\t\t \"title\": \"string\",\r\n\t\t \"author\": \"string\"\r\n\t\t},\r\n\t\tadapter: {\r\n\t\t\ttype: \"sql\",\r\n\t\t\tcollection_name: \"book\"\r\n\t\t}\r\n\t},\r\n\textendModel: function(Model) {\r\n\t\t_.extend(Model.prototype, {\r\n\t\t\t// extended functions and properties go here\r\n\t\t});\r\n\r\n\t\treturn Model;\r\n\t},\r\n\textendCollection: function(Collection) {\r\n\t\t_.extend(Collection.prototype, {\r\n\t\t\t// extended functions and properties go here\r\n\r\n\t\t\t// For Backbone v1.1.2, uncomment the following to override the\r\n\t\t\t// fetch method to account for a breaking change in Backbone.\r\n\t\t\t/*\r\n\t\t\tfetch: function(options) {\r\n\t\t\t\toptions = options ? _.clone(options) : {};\r\n\t\t\t\toptions.reset = true;\r\n\t\t\t\treturn Backbone.Collection.prototype.fetch.call(this, options);\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t});\r\n\r\n\t\treturn Collection;\r\n\t}\r\n};\r\n{code}\r\n\r\n\r\n\r\n", "attachment": [], "flagged": false, "summary": "Data Binding: Deep Link Binding Broken", "creator": { "name": "zlitten", "key": "zlitten", "displayName": "Zachary Litten", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "zlitten", "key": "zlitten", "displayName": "Zachary Litten", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "MacOS Sierra\r\nTitanium SDK 7.1.1GA\r\nAlloy version 1.12.0", "comment": { "comments": [ { "id": "438242", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "The error suggests an issue within your code:\r\n{code}\r\nSyntaxError: Unexpected token, expected ; (57:154)\r\n{code}\r\nIt looks like inside the generated code, so you should check the generated Alloy code in Resources/ and find the related part of your source code from there.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-08T05:44:32.000+0000", "updated": "2018-06-08T05:44:32.000+0000" }, { "id": "438255", "author": { "name": "zlitten", "key": "zlitten", "displayName": "Zachary Litten", "active": true, "timeZone": "America/Los_Angeles" }, "body": "That error during the compilation is preventing me from looking at that the file since it's derived but it shows it in the console output.\r\n\r\nFrom testing I've found that the deep object binding works with the Collection. The compiler error occurs whenever I try to reference the Model in the binding like \"{book.title}\" or \"{$.Book.title}\" like I see in the Alloy Data Binding docs.\r\n\r\nWhen I try just the normal, shallow data binding with the Model it will compile and start the test app correctly, but I get an undefined error when opening the Window that the ListView is inside. \r\n\r\n{noformat}\r\n[ERROR] : TiExceptionHandler: (main) [80508,80508] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] : TiExceptionHandler: (main) [0,80508] - In /alloy/controllers/test.js:50,73\r\n[ERROR] : TiExceptionHandler: (main) [1,80509] - Message: Uncaught TypeError: Cannot read property '__transform' of undefined\r\n[ERROR] : TiExceptionHandler: (main) [0,80509] - Source: \tvar __alloyId21 = [];$.__views.__alloyId22 = { bookLbl: { text: $model.__transform.title + ' by ' + $model.__transform.author }, template: \"book\", properties: { id: \"__alloyId22\" } };__alloyId21.push($.__views.__alloyId22);$.__views.__alloyId17 = Ti.UI.createListSection(\r\n{noformat}\r\n\r\nLooking further into the generated Alloy file, the declaration of the model looks a little weird, but I'm not really familiar with the Alloy generated files anyways. The model declaration may not even be getting ran.\r\n\r\n{code:javascript}\r\nif (arguments[0]) {\r\n\t\tvar __parentSymbol = __processArg(arguments[0], '__parentSymbol');\r\n\t\tvar $model = __processArg(arguments[0], '$model');\r\n\t\tvar __itemTemplate = __processArg(arguments[0], '__itemTemplate');\r\n\t}\r\n{code}\r\n\r\n\r\n\r\n", "updateAuthor": { "name": "zlitten", "key": "zlitten", "displayName": "Zachary Litten", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-08T18:49:24.000+0000", "updated": "2018-06-08T18:50:41.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }