|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | exports.__esModule = true;
|
|---|
| 4 | exports.default = void 0;
|
|---|
| 5 |
|
|---|
| 6 | /**
|
|---|
| 7 | * Safari 10.3 had an issue where async arrow function expressions within any class method would throw.
|
|---|
| 8 | * After an initial fix, any references to the instance via `this` within those methods would also throw.
|
|---|
| 9 | * This is fixed by converting arrow functions in class methods into equivalent function expressions.
|
|---|
| 10 | * @see https://bugs.webkit.org/show_bug.cgi?id=166879
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * class X{ a(){ async () => {}; } } // throws
|
|---|
| 14 | * class X{ a(){ async function() {}; } } // works
|
|---|
| 15 | *
|
|---|
| 16 | * @example
|
|---|
| 17 | * class X{ a(){
|
|---|
| 18 | * async () => this.a; // throws
|
|---|
| 19 | * } }
|
|---|
| 20 | * class X{ a(){
|
|---|
| 21 | * var _this=this;
|
|---|
| 22 | * async function() { return _this.a }; // works
|
|---|
| 23 | * } }
|
|---|
| 24 | */
|
|---|
| 25 | const OPTS = {
|
|---|
| 26 | allowInsertArrow: false,
|
|---|
| 27 | specCompliant: false
|
|---|
| 28 | };
|
|---|
| 29 |
|
|---|
| 30 | var _default = ({
|
|---|
| 31 | types: t
|
|---|
| 32 | }) => ({
|
|---|
| 33 | name: "transform-async-arrows-in-class",
|
|---|
| 34 | visitor: {
|
|---|
| 35 | ArrowFunctionExpression(path) {
|
|---|
| 36 | if (path.node.async && path.findParent(t.isClassMethod)) {
|
|---|
| 37 | path.arrowFunctionToExpression(OPTS);
|
|---|
| 38 | }
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | }
|
|---|
| 42 | });
|
|---|
| 43 |
|
|---|
| 44 | exports.default = _default;
|
|---|
| 45 | module.exports = exports.default; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.