Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
715 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Florent Cailhol @ooflorent
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | const ConstDependency = require("./ConstDependency");
|
---|
9 | const HarmonyExports = require("./HarmonyExports");
|
---|
10 |
|
---|
11 | class HarmonyTopLevelThisParserPlugin {
|
---|
12 | apply(parser) {
|
---|
13 | parser.hooks.expression
|
---|
14 | .for("this")
|
---|
15 | .tap("HarmonyTopLevelThisParserPlugin", node => {
|
---|
16 | if (!parser.scope.topLevelScope) return;
|
---|
17 | if (HarmonyExports.isEnabled(parser.state)) {
|
---|
18 | const dep = new ConstDependency("undefined", node.range, null);
|
---|
19 | dep.loc = node.loc;
|
---|
20 | parser.state.module.addPresentationalDependency(dep);
|
---|
21 | return this;
|
---|
22 | }
|
---|
23 | });
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
27 | module.exports = HarmonyTopLevelThisParserPlugin;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.