Merge pull request #30494 from Microsoft/fix29561
Prevent substitution of 'super' in async super helper
This commit is contained in:
commit
a0f122baa7
5 changed files with 493 additions and 6 deletions
|
@ -690,9 +690,15 @@ namespace ts {
|
||||||
/* parameters */ [],
|
/* parameters */ [],
|
||||||
/* type */ undefined,
|
/* type */ undefined,
|
||||||
/* equalsGreaterThanToken */ undefined,
|
/* equalsGreaterThanToken */ undefined,
|
||||||
createPropertyAccess(
|
setEmitFlags(
|
||||||
createSuper(),
|
createPropertyAccess(
|
||||||
name
|
setEmitFlags(
|
||||||
|
createSuper(),
|
||||||
|
EmitFlags.NoSubstitution
|
||||||
|
),
|
||||||
|
name
|
||||||
|
),
|
||||||
|
EmitFlags.NoSubstitution
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
@ -717,9 +723,16 @@ namespace ts {
|
||||||
/* type */ undefined,
|
/* type */ undefined,
|
||||||
/* equalsGreaterThanToken */ undefined,
|
/* equalsGreaterThanToken */ undefined,
|
||||||
createAssignment(
|
createAssignment(
|
||||||
createPropertyAccess(
|
setEmitFlags(
|
||||||
createSuper(),
|
createPropertyAccess(
|
||||||
name),
|
setEmitFlags(
|
||||||
|
createSuper(),
|
||||||
|
EmitFlags.NoSubstitution
|
||||||
|
),
|
||||||
|
name
|
||||||
|
),
|
||||||
|
EmitFlags.NoSubstitution
|
||||||
|
),
|
||||||
createIdentifier("v")
|
createIdentifier("v")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -124,6 +124,66 @@ class B extends A {
|
||||||
// element access (assign) in async arrow
|
// element access (assign) in async arrow
|
||||||
(async () => super["x"] = f);
|
(async () => super["x"] = f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async * property_access_only_read_only_in_generator() {
|
||||||
|
// call with property access
|
||||||
|
super.x();
|
||||||
|
|
||||||
|
// property access (read)
|
||||||
|
const a = super.x;
|
||||||
|
|
||||||
|
// property access in arrow
|
||||||
|
(() => super.x());
|
||||||
|
|
||||||
|
// property access in async arrow
|
||||||
|
(async () => super.x());
|
||||||
|
}
|
||||||
|
|
||||||
|
async * property_access_only_write_only_in_generator() {
|
||||||
|
const f = () => {};
|
||||||
|
|
||||||
|
// property access (assign)
|
||||||
|
super.x = f;
|
||||||
|
|
||||||
|
// destructuring assign with property access
|
||||||
|
({ f: super.x } = { f });
|
||||||
|
|
||||||
|
// property access (assign) in arrow
|
||||||
|
(() => super.x = f);
|
||||||
|
|
||||||
|
// property access (assign) in async arrow
|
||||||
|
(async () => super.x = f);
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_read_only_in_generator() {
|
||||||
|
// call with element access
|
||||||
|
super["x"]();
|
||||||
|
|
||||||
|
// element access (read)
|
||||||
|
const a = super["x"];
|
||||||
|
|
||||||
|
// element access in arrow
|
||||||
|
(() => super["x"]());
|
||||||
|
|
||||||
|
// element access in async arrow
|
||||||
|
(async () => super["x"]());
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_write_only_in_generator() {
|
||||||
|
const f = () => {};
|
||||||
|
|
||||||
|
// element access (assign)
|
||||||
|
super["x"] = f;
|
||||||
|
|
||||||
|
// destructuring assign with element access
|
||||||
|
({ f: super["x"] } = { f });
|
||||||
|
|
||||||
|
// element access (assign) in arrow
|
||||||
|
(() => super["x"] = f);
|
||||||
|
|
||||||
|
// element access (assign) in async arrow
|
||||||
|
(async () => super["x"] = f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,4 +313,67 @@ class B extends A {
|
||||||
(() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").value = f; }));
|
(() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").value = f; }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
property_access_only_read_only_in_generator() {
|
||||||
|
const _super = Object.create(null, {
|
||||||
|
x: { get: () => super.x }
|
||||||
|
});
|
||||||
|
return __asyncGenerator(this, arguments, function* property_access_only_read_only_in_generator_1() {
|
||||||
|
// call with property access
|
||||||
|
_super.x.call(this);
|
||||||
|
// property access (read)
|
||||||
|
const a = _super.x;
|
||||||
|
// property access in arrow
|
||||||
|
(() => _super.x.call(this));
|
||||||
|
// property access in async arrow
|
||||||
|
(() => __awaiter(this, void 0, void 0, function* () { return _super.x.call(this); }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
property_access_only_write_only_in_generator() {
|
||||||
|
const _super = Object.create(null, {
|
||||||
|
x: { get: () => super.x, set: v => super.x = v }
|
||||||
|
});
|
||||||
|
return __asyncGenerator(this, arguments, function* property_access_only_write_only_in_generator_1() {
|
||||||
|
const f = () => { };
|
||||||
|
// property access (assign)
|
||||||
|
_super.x = f;
|
||||||
|
// destructuring assign with property access
|
||||||
|
({ f: _super.x } = { f });
|
||||||
|
// property access (assign) in arrow
|
||||||
|
(() => _super.x = f);
|
||||||
|
// property access (assign) in async arrow
|
||||||
|
(() => __awaiter(this, void 0, void 0, function* () { return _super.x = f; }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
element_access_only_read_only_in_generator() {
|
||||||
|
const _superIndex = name => super[name];
|
||||||
|
const _super = Object.create(null, {});
|
||||||
|
return __asyncGenerator(this, arguments, function* element_access_only_read_only_in_generator_1() {
|
||||||
|
// call with element access
|
||||||
|
_superIndex("x").call(this);
|
||||||
|
// element access (read)
|
||||||
|
const a = _superIndex("x");
|
||||||
|
// element access in arrow
|
||||||
|
(() => _superIndex("x").call(this));
|
||||||
|
// element access in async arrow
|
||||||
|
(() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").call(this); }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
element_access_only_write_only_in_generator() {
|
||||||
|
const _superIndex = (function (geti, seti) {
|
||||||
|
const cache = Object.create(null);
|
||||||
|
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
|
||||||
|
})(name => super[name], (name, value) => super[name] = value);
|
||||||
|
const _super = Object.create(null, {});
|
||||||
|
return __asyncGenerator(this, arguments, function* element_access_only_write_only_in_generator_1() {
|
||||||
|
const f = () => { };
|
||||||
|
// element access (assign)
|
||||||
|
_superIndex("x").value = f;
|
||||||
|
// destructuring assign with element access
|
||||||
|
({ f: _superIndex("x").value } = { f });
|
||||||
|
// element access (assign) in arrow
|
||||||
|
(() => _superIndex("x").value = f);
|
||||||
|
// element access (assign) in async arrow
|
||||||
|
(() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").value = f; }));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,5 +252,127 @@ class B extends A {
|
||||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 111, 13))
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 111, 13))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async * property_access_only_read_only_in_generator() {
|
||||||
|
>property_access_only_read_only_in_generator : Symbol(B.property_access_only_read_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 124, 5))
|
||||||
|
|
||||||
|
// call with property access
|
||||||
|
super.x();
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
|
||||||
|
// property access (read)
|
||||||
|
const a = super.x;
|
||||||
|
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 131, 13))
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
|
||||||
|
// property access in arrow
|
||||||
|
(() => super.x());
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
|
||||||
|
// property access in async arrow
|
||||||
|
(async () => super.x());
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
}
|
||||||
|
|
||||||
|
async * property_access_only_write_only_in_generator() {
|
||||||
|
>property_access_only_write_only_in_generator : Symbol(B.property_access_only_write_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 138, 5))
|
||||||
|
|
||||||
|
const f = () => {};
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
|
||||||
|
|
||||||
|
// property access (assign)
|
||||||
|
super.x = f;
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
|
||||||
|
|
||||||
|
// destructuring assign with property access
|
||||||
|
({ f: super.x } = { f });
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 147, 10))
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 147, 27))
|
||||||
|
|
||||||
|
// property access (assign) in arrow
|
||||||
|
(() => super.x = f);
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
|
||||||
|
|
||||||
|
// property access (assign) in async arrow
|
||||||
|
(async () => super.x = f);
|
||||||
|
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_read_only_in_generator() {
|
||||||
|
>element_access_only_read_only_in_generator : Symbol(B.element_access_only_read_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 154, 5))
|
||||||
|
|
||||||
|
// call with element access
|
||||||
|
super["x"]();
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
|
||||||
|
// element access (read)
|
||||||
|
const a = super["x"];
|
||||||
|
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 161, 13))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
|
||||||
|
// element access in arrow
|
||||||
|
(() => super["x"]());
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
|
||||||
|
// element access in async arrow
|
||||||
|
(async () => super["x"]());
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_write_only_in_generator() {
|
||||||
|
>element_access_only_write_only_in_generator : Symbol(B.element_access_only_write_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 168, 5))
|
||||||
|
|
||||||
|
const f = () => {};
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
|
||||||
|
|
||||||
|
// element access (assign)
|
||||||
|
super["x"] = f;
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
|
||||||
|
|
||||||
|
// destructuring assign with element access
|
||||||
|
({ f: super["x"] } = { f });
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 177, 10))
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 177, 30))
|
||||||
|
|
||||||
|
// element access (assign) in arrow
|
||||||
|
(() => super["x"] = f);
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
|
||||||
|
|
||||||
|
// element access (assign) in async arrow
|
||||||
|
(async () => super["x"] = f);
|
||||||
|
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||||
|
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||||
|
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -332,6 +332,174 @@ class B extends A {
|
||||||
>super["x"] : () => void
|
>super["x"] : () => void
|
||||||
>super : A
|
>super : A
|
||||||
>"x" : "x"
|
>"x" : "x"
|
||||||
|
>f : () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
async * property_access_only_read_only_in_generator() {
|
||||||
|
>property_access_only_read_only_in_generator : () => AsyncIterableIterator<any>
|
||||||
|
|
||||||
|
// call with property access
|
||||||
|
super.x();
|
||||||
|
>super.x() : void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
|
||||||
|
// property access (read)
|
||||||
|
const a = super.x;
|
||||||
|
>a : () => void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
|
||||||
|
// property access in arrow
|
||||||
|
(() => super.x());
|
||||||
|
>(() => super.x()) : () => void
|
||||||
|
>() => super.x() : () => void
|
||||||
|
>super.x() : void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
|
||||||
|
// property access in async arrow
|
||||||
|
(async () => super.x());
|
||||||
|
>(async () => super.x()) : () => Promise<void>
|
||||||
|
>async () => super.x() : () => Promise<void>
|
||||||
|
>super.x() : void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
async * property_access_only_write_only_in_generator() {
|
||||||
|
>property_access_only_write_only_in_generator : () => AsyncIterableIterator<any>
|
||||||
|
|
||||||
|
const f = () => {};
|
||||||
|
>f : () => void
|
||||||
|
>() => {} : () => void
|
||||||
|
|
||||||
|
// property access (assign)
|
||||||
|
super.x = f;
|
||||||
|
>super.x = f : () => void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
>f : () => void
|
||||||
|
|
||||||
|
// destructuring assign with property access
|
||||||
|
({ f: super.x } = { f });
|
||||||
|
>({ f: super.x } = { f }) : { f: () => void; }
|
||||||
|
>{ f: super.x } = { f } : { f: () => void; }
|
||||||
|
>{ f: super.x } : { f: () => void; }
|
||||||
|
>f : () => void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
>{ f } : { f: () => void; }
|
||||||
|
>f : () => void
|
||||||
|
|
||||||
|
// property access (assign) in arrow
|
||||||
|
(() => super.x = f);
|
||||||
|
>(() => super.x = f) : () => () => void
|
||||||
|
>() => super.x = f : () => () => void
|
||||||
|
>super.x = f : () => void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
>f : () => void
|
||||||
|
|
||||||
|
// property access (assign) in async arrow
|
||||||
|
(async () => super.x = f);
|
||||||
|
>(async () => super.x = f) : () => Promise<() => void>
|
||||||
|
>async () => super.x = f : () => Promise<() => void>
|
||||||
|
>super.x = f : () => void
|
||||||
|
>super.x : () => void
|
||||||
|
>super : A
|
||||||
|
>x : () => void
|
||||||
|
>f : () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_read_only_in_generator() {
|
||||||
|
>element_access_only_read_only_in_generator : () => AsyncIterableIterator<any>
|
||||||
|
|
||||||
|
// call with element access
|
||||||
|
super["x"]();
|
||||||
|
>super["x"]() : void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
|
|
||||||
|
// element access (read)
|
||||||
|
const a = super["x"];
|
||||||
|
>a : () => void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
|
|
||||||
|
// element access in arrow
|
||||||
|
(() => super["x"]());
|
||||||
|
>(() => super["x"]()) : () => void
|
||||||
|
>() => super["x"]() : () => void
|
||||||
|
>super["x"]() : void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
|
|
||||||
|
// element access in async arrow
|
||||||
|
(async () => super["x"]());
|
||||||
|
>(async () => super["x"]()) : () => Promise<void>
|
||||||
|
>async () => super["x"]() : () => Promise<void>
|
||||||
|
>super["x"]() : void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_write_only_in_generator() {
|
||||||
|
>element_access_only_write_only_in_generator : () => AsyncIterableIterator<any>
|
||||||
|
|
||||||
|
const f = () => {};
|
||||||
|
>f : () => void
|
||||||
|
>() => {} : () => void
|
||||||
|
|
||||||
|
// element access (assign)
|
||||||
|
super["x"] = f;
|
||||||
|
>super["x"] = f : () => void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
|
>f : () => void
|
||||||
|
|
||||||
|
// destructuring assign with element access
|
||||||
|
({ f: super["x"] } = { f });
|
||||||
|
>({ f: super["x"] } = { f }) : { f: () => void; }
|
||||||
|
>{ f: super["x"] } = { f } : { f: () => void; }
|
||||||
|
>{ f: super["x"] } : { f: () => void; }
|
||||||
|
>f : () => void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
|
>{ f } : { f: () => void; }
|
||||||
|
>f : () => void
|
||||||
|
|
||||||
|
// element access (assign) in arrow
|
||||||
|
(() => super["x"] = f);
|
||||||
|
>(() => super["x"] = f) : () => () => void
|
||||||
|
>() => super["x"] = f : () => () => void
|
||||||
|
>super["x"] = f : () => void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
|
>f : () => void
|
||||||
|
|
||||||
|
// element access (assign) in async arrow
|
||||||
|
(async () => super["x"] = f);
|
||||||
|
>(async () => super["x"] = f) : () => Promise<() => void>
|
||||||
|
>async () => super["x"] = f : () => Promise<() => void>
|
||||||
|
>super["x"] = f : () => void
|
||||||
|
>super["x"] : () => void
|
||||||
|
>super : A
|
||||||
|
>"x" : "x"
|
||||||
>f : () => void
|
>f : () => void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @target: ES6
|
// @target: ES6
|
||||||
|
// @lib: esnext
|
||||||
// @noEmitHelpers: true
|
// @noEmitHelpers: true
|
||||||
class A {
|
class A {
|
||||||
x() {
|
x() {
|
||||||
|
@ -125,4 +126,64 @@ class B extends A {
|
||||||
// element access (assign) in async arrow
|
// element access (assign) in async arrow
|
||||||
(async () => super["x"] = f);
|
(async () => super["x"] = f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async * property_access_only_read_only_in_generator() {
|
||||||
|
// call with property access
|
||||||
|
super.x();
|
||||||
|
|
||||||
|
// property access (read)
|
||||||
|
const a = super.x;
|
||||||
|
|
||||||
|
// property access in arrow
|
||||||
|
(() => super.x());
|
||||||
|
|
||||||
|
// property access in async arrow
|
||||||
|
(async () => super.x());
|
||||||
|
}
|
||||||
|
|
||||||
|
async * property_access_only_write_only_in_generator() {
|
||||||
|
const f = () => {};
|
||||||
|
|
||||||
|
// property access (assign)
|
||||||
|
super.x = f;
|
||||||
|
|
||||||
|
// destructuring assign with property access
|
||||||
|
({ f: super.x } = { f });
|
||||||
|
|
||||||
|
// property access (assign) in arrow
|
||||||
|
(() => super.x = f);
|
||||||
|
|
||||||
|
// property access (assign) in async arrow
|
||||||
|
(async () => super.x = f);
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_read_only_in_generator() {
|
||||||
|
// call with element access
|
||||||
|
super["x"]();
|
||||||
|
|
||||||
|
// element access (read)
|
||||||
|
const a = super["x"];
|
||||||
|
|
||||||
|
// element access in arrow
|
||||||
|
(() => super["x"]());
|
||||||
|
|
||||||
|
// element access in async arrow
|
||||||
|
(async () => super["x"]());
|
||||||
|
}
|
||||||
|
|
||||||
|
async * element_access_only_write_only_in_generator() {
|
||||||
|
const f = () => {};
|
||||||
|
|
||||||
|
// element access (assign)
|
||||||
|
super["x"] = f;
|
||||||
|
|
||||||
|
// destructuring assign with element access
|
||||||
|
({ f: super["x"] } = { f });
|
||||||
|
|
||||||
|
// element access (assign) in arrow
|
||||||
|
(() => super["x"] = f);
|
||||||
|
|
||||||
|
// element access (assign) in async arrow
|
||||||
|
(async () => super["x"] = f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue