| Summary: | Wrong no-undef-expression error reported for array access | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||
| Component: | JS Tools | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | Michael_Rennie | ||||
| Version: | 11.0 | Flags: | Michael_Rennie:
review+
|
||||
| Target Milestone: | 12.0 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
I would vote to fix this for 12.0. This doesn't look too good for array access. Created attachment 262518 [details]
Proposed patch including regression tests
Delivered. Closing as fixed. Michael, please review. |
The following code: var f = function() {}; var g = function() {}; const funcs = [f, g]; function func(i) { return funcs[i - 1](); } returns 'undefined' is undefined for Array in ... This is just plain wrong. The problem comes from the fact that the no-undef-expression check gets undefined when getting the property name for 'i - 1'. I think in this case, we should simply skip the check if there is no property name.