* Update member-expression-to-functions 1. Babel using British spellings, so `memoise` 2. Provide a helper `AssignmentMemoiser` class, which will assign the memo'd value with the `n`th access. * Private properties! * Fixes * Tests * Update helper name * Fix privates that reference other privates * Don't extend a builtin * Rebase
28 lines
511 B
JavaScript
28 lines
511 B
JavaScript
class Foo {
|
|
#foo = 0;
|
|
|
|
test(other) {
|
|
return [
|
|
this.#foo++,
|
|
this.#foo,
|
|
++this.#foo,
|
|
this.#foo,
|
|
other.obj.#foo++,
|
|
other.obj.#foo,
|
|
++other.obj.#foo,
|
|
other.obj.#foo,
|
|
];
|
|
}
|
|
}
|
|
|
|
const f = new Foo;
|
|
const results = f.test({ obj: f });
|
|
expect(results[0]).toBe(0);
|
|
expect(results[1]).toBe(1);
|
|
expect(results[2]).toBe(2);
|
|
expect(results[3]).toBe(2);
|
|
expect(results[4]).toBe(2);
|
|
expect(results[5]).toBe(3);
|
|
expect(results[6]).toBe(4);
|
|
expect(results[7]).toBe(4);
|