* fix(class-properties): replace `new.target` in static properties with `undefined` non-static prop is not affected fix #12737 * Update packages/babel-helper-create-class-features-plugin/src/fields.ts fix typo Co-authored-by: Brian Ng <bng412@gmail.com> * fix: add loose test case and fix replace condition * test: add new.target tests for static block * feat: move new-target replace into thisContextVisitor defaults to replace new.target, do not replace within function * feat: simplify thisContextVisitor remove function visitor since environmentVisitor is skipping arrow function * test: remove unused fixme comments Co-authored-by: Brian Ng <bng412@gmail.com>
21 lines
493 B
JavaScript
21 lines
493 B
JavaScript
class Foo {
|
|
constructor() {
|
|
this.Bar = class {
|
|
static p = new.target
|
|
static p1 = class { constructor() { new.target } } // should not replace
|
|
static p2 = new function () { new.target } // should not replace
|
|
static p3 = () => { new.target } // should replace
|
|
static p4 = function () { new.target } // should not replace
|
|
q = new.target // should not replace
|
|
}
|
|
}
|
|
|
|
test = function() {
|
|
new.target;
|
|
};
|
|
|
|
test2 = () => {
|
|
new.target;
|
|
}
|
|
}
|