123456789101112131415161718192021222324252627282930313233343536373839 |
- "use strict";
- const ConstDependency = require("./ConstDependency");
- const HarmonyExports = require("./HarmonyExports");
- class HarmonyTopLevelThisParserPlugin {
-
- apply(parser) {
- parser.hooks.expression
- .for("this")
- .tap("HarmonyTopLevelThisParserPlugin", node => {
- if (!parser.scope.topLevelScope) return;
- if (HarmonyExports.isEnabled(parser.state)) {
- const dep = new ConstDependency(
- "undefined",
- (node.range),
- null
- );
- dep.loc = (node.loc);
- parser.state.module.addPresentationalDependency(dep);
- return true;
- }
- });
- }
- }
- module.exports = HarmonyTopLevelThisParserPlugin;
|