Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.12.0 Alpha, 5.12.0
-
None
Description
class LinkedList { push(...values) { for (const value of values) this.head = { value, next: this.head }; return this; } values() { const values = []; // causes "Identifier values has already been declared" for (let node = this.head; node !== undefined; node = node.next) values.push(node.value); return values; } }
Code above works well both in Node and modern browsers.
But this will work in QML:
function clone(origin) { const length = origin.length; const clone = new Array(length); // works fine, even though have same name as function for (let i = 0; i < length; i++) clone[i] = origin[i]; return clone; } function LinkedList() { } LinkedList.prototype.values = function () { const values = []; // fine too, but i suppose this function should implicitly have "values" name for (let node = this.head; node !== undefined; node = node.next) values.push(node.value); return values; }
But this will fail again:
function LinkedList() { } LinkedList.prototype.values = function values() { const values = []; // error here for (let node = this.head; node !== undefined; node = node.next) values.push(node.value); return values; }