source: imaps-frontend/node_modules/webpack/lib/dependencies/HarmonyTopLevelThisParserPlugin.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Florent Cailhol @ooflorent
4*/
5
6"use strict";
7
8const ConstDependency = require("./ConstDependency");
9const HarmonyExports = require("./HarmonyExports");
10
11/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
12/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
13/** @typedef {import("../javascript/JavascriptParser").Range} Range */
14
15class HarmonyTopLevelThisParserPlugin {
16 /**
17 * @param {JavascriptParser} parser the parser
18 * @returns {void}
19 */
20 apply(parser) {
21 parser.hooks.expression
22 .for("this")
23 .tap("HarmonyTopLevelThisParserPlugin", node => {
24 if (!parser.scope.topLevelScope) return;
25 if (HarmonyExports.isEnabled(parser.state)) {
26 const dep = new ConstDependency(
27 "undefined",
28 /** @type {Range} */ (node.range),
29 null
30 );
31 dep.loc = /** @type {DependencyLocation} */ (node.loc);
32 parser.state.module.addPresentationalDependency(dep);
33 return true;
34 }
35 });
36 }
37}
38
39module.exports = HarmonyTopLevelThisParserPlugin;
Note: See TracBrowser for help on using the repository browser.