| Summary: | Rename element seems to miss the last occurrence | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Eric Moffatt <emoffatt> | ||||
| Component: | JS Tools | Assignee: | Michael Rennie <Michael_Rennie> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P2 | CC: | Michael_Rennie, steve_northover | ||||
| Version: | 10.0 | ||||||
| Target Milestone: | 10.0 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Here's the offending code...
run: function run(server, query) {
var property = this._getDefNode(server, query);
while (property) {
var fileName = property.value.sourceFile.name;
var newQuery = {start: property.value.range[0],
end: property.value.range[1],
type: "definition", //$NON-NLS-1$
file: fileName};
if (property.value.type === "FunctionExpression") {
return {implementation: newQuery};
} else if (property.value.type === "Identifier") {
property = this._getDefNode(server, newQuery);
}
}
return {implementation: {}};
},
Curtis, can you fix this one (or determine that it is not a regression at least)? This is basic functionality that is broken. Is it also broken in prod etc.? Sorry I don't have time to chase it down. (In reply to Steve Northover from comment #2) > Curtis, can you fix this one (or determine that it is not a regression at > least)? This is basic functionality that is broken. Is it also broken in > prod etc.? Sorry I don't have time to chase it down. Here is a simple snippet to reproduce: var foo = { run: function () { var property = {}; if (property.value.type === "Identifier") { property = {}; } } } It is not a regression. I have too many changes in my workspace right now to try the latest version of Tern to see if it is fixed. This was indeed a bug in Tern. It was not visiting the variable pattern. Fixed in: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=0c4b2adccf0825b0ae080bb5c707667ca4ee800a I also confirmed it is fixed in the latest version of Tern: https://github.com/marijnh/tern/blob/master/lib/infer.js#L2067 |
Created attachment 256291 [details] note that the last ref to 'property' isn't selected I was just coding and tried to use the Rename Element...it missed the last occurrence (see attached image)...