[ALOY-710] Alloy: Line number reported in the 'Errors' report is not always accurate if referring to a compiled file in the 'Resources' folder.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.5.0 |
Components | Runtime |
Labels | qe-3.1.1, qe-manualtest |
Reporter | Federico Casali |
Assignee | Tim Poulsen |
Created | 2013-06-13T00:44:28.000+0000 |
Updated | 2014-12-03T22:29:45.000+0000 |
Description
Problem description
Report errors relative to Resources compiled code could display an incorrect Line position. In the following sample, an wrong function name is used inside a Titanium UI object defined in the Markup .XML. The function does not exist, Alloy still compile the code and the Code Analyzer completes the analysis. The function is detected as an error, however the number Line is in this case wrong.Steps to reproduce
1. Use the following sample codeindex.js
<Alloy>
<Window class="container">
<Label id="label" onClick="foobar">Hello, World</Label>
</Window>
</Alloy>
index.tss
"Window":{
backgroundColor: 'white'
}
"Label":{
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000"
}
index.js
$.index.open();
2. Run the Code Analyzer
3. Results: "foobar" is correctly reported as not defined. However, the Line position looks wrong.
Attaching screenshot and 'Resources/alloy/controllers/index.js'.
function Controller() {
require("alloy/controllers/BaseController").apply(this, Array.prototype.slice.call(arguments));
arguments[0] ? arguments[0]["__parentSymbol"] : null;
arguments[0] ? arguments[0]["$model"] : null;
var $ = this;
var exports = {};
var __defers = {};
$.__views.index = Ti.UI.createWindow({
backgroundColor: "white",
id: "index"
});
$.__views.index && $.addTopLevelView($.__views.index);
$.__views.label = Ti.UI.createLabel({
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000",
text: "Hello, World",
id: "label"
});
$.__views.index.add($.__views.label);
foobar ? $.__views.label.addEventListener("click", foobar) : __defers["$.__views.label!click!foobar"] = true;
exports.destroy = function() {};
_.extend($, $.__views);
$.index.open();
__defers["$.__views.label!click!foobar"] && $.__views.label.addEventListener("click", foobar);
_.extend($, exports);
}
var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._;
module.exports = Controller;
Reports errors on line 30, 30 and 43.
Attachments
File | Date | Size |
---|---|---|
index.js | 2013-06-13T00:44:28.000+0000 | 1105 |
Screen Shot 2013-06-12 at 5.34.11 PM.png | 2013-06-13T00:44:28.000+0000 | 23551 |
StudioDetects.png | 2014-08-28T23:11:58.000+0000 | 21605 |