Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
671 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = rewriteThis;
|
---|
7 |
|
---|
8 | var _helperReplaceSupers = require("@babel/helper-replace-supers");
|
---|
9 |
|
---|
10 | var _traverse = require("@babel/traverse");
|
---|
11 |
|
---|
12 | var _t = require("@babel/types");
|
---|
13 |
|
---|
14 | const {
|
---|
15 | numericLiteral,
|
---|
16 | unaryExpression
|
---|
17 | } = _t;
|
---|
18 |
|
---|
19 | function rewriteThis(programPath) {
|
---|
20 | (0, _traverse.default)(programPath.node, Object.assign({}, rewriteThisVisitor, {
|
---|
21 | noScope: true
|
---|
22 | }));
|
---|
23 | }
|
---|
24 |
|
---|
25 | const rewriteThisVisitor = _traverse.default.visitors.merge([_helperReplaceSupers.environmentVisitor, {
|
---|
26 | ThisExpression(path) {
|
---|
27 | path.replaceWith(unaryExpression("void", numericLiteral(0), true));
|
---|
28 | }
|
---|
29 |
|
---|
30 | }]); |
---|
Note:
See
TracBrowser
for help on using the repository browser.