/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var NullDependency = require("./NullDependency");

function HarmonyExportExpressionDependency(originModule, range, rangeStatement) {
	NullDependency.call(this);
	this.originModule = originModule;
	this.range = range;
	this.rangeStatement = rangeStatement;
}
module.exports = HarmonyExportExpressionDependency;

HarmonyExportExpressionDependency.prototype = Object.create(NullDependency.prototype);
HarmonyExportExpressionDependency.prototype.constructor = HarmonyExportExpressionDependency;
HarmonyExportExpressionDependency.prototype.type = "harmony export expression";

HarmonyExportExpressionDependency.prototype.getExports = function() {
	return {
		exports: ["default"]
	};
};

HarmonyExportExpressionDependency.prototype.describeHarmonyExport = function() {
	return {
		exportedName: "default",
		precedence: 1
	};
};

HarmonyExportExpressionDependency.Template = function HarmonyExportDependencyTemplate() {};

HarmonyExportExpressionDependency.Template.prototype.apply = function(dep, source) {
	var used = dep.originModule.isUsed("default");
	var content;
	if(used)
		content = "/* harmony default export */ exports[" + JSON.stringify(used) + "] = ";
	else
		content = "/* unused harmony default export */ var _unused_webpack_default_export = ";
	if(dep.range) {
		source.replace(dep.rangeStatement[0], dep.range[0] - 1, content);
		source.replace(dep.range[1], dep.rangeStatement[1] - 1, ";");
	} else {
		source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content);
	}
};

@@ -93,19 +93,35 @@
 okra%0A*/%0A
-var
+%22use strict%22;%0Aconst
  NullDep
@@ -160,24 +160,21 @@
 ncy%22);%0A%0A
-function
+class
  Harmony
@@ -199,16 +199,54 @@
 pendency
+ extends NullDependency %7B%0A%09constructor
 (originM
@@ -282,35 +282,19 @@
  %7B%0A%09
-NullDependency.call(this
+%09super(
 );%0A
+%09
 %09thi
@@ -324,16 +324,17 @@
 Module;%0A
+%09
 %09this.ra
@@ -346,16 +346,17 @@
  range;%0A
+%09
 %09this.ra
@@ -390,394 +390,85 @@
 nt;%0A
+%09
 %7D%0A
-module.exports = HarmonyExportExpressionDependency;%0A%0AHarmonyExportExpressionDependency.prototype = Object.create(NullDependency.prototype);%0AHarmonyExportExpressionDependency.prototype.constructor = HarmonyExportExpressionDependency;%0AHarmonyExportExpressionDependency.prototype.type = %22harmony export expression%22;%0A%0AHarmonyExportExpressionDependency.prototype.getExports = function
+%0A%09get type() %7B%0A%09%09return %22harmony export expression%22;%0A%09%7D%0A%0A%09getExports
 () %7B%0A
+%09
 %09ret
@@ -465,32 +465,33 @@
 () %7B%0A%09%09return %7B%0A
+%09
 %09%09exports: %5B%22def
@@ -501,60 +501,18 @@
 t%22%5D%0A
+%09
 %09%7D;%0A
-%7D;%0A%0AHarmonyExportExpressionDependency.prototype.
+%09%7D%0A%0A%09
 desc
@@ -532,24 +532,14 @@
 port
- = function
 () %7B%0A
+%09
 %09ret
@@ -544,16 +544,17 @@
 eturn %7B%0A
+%09
 %09%09export
@@ -574,16 +574,17 @@
 ult%22,%0A%09%09
+%09
 preceden
@@ -592,15 +592,19 @@
 e: 1
+,
 %0A
+%09
 %09%7D;%0A
+%09%7D%0A
 %7D
-;
 %0A%0AHa
@@ -646,24 +646,21 @@
 plate = 
-function
+class
  Harmony
@@ -687,85 +687,17 @@
 late
-() %7B%7D;%0A%0AHarmonyExportExpressionDependency.Template.prototype.apply = function
+ %7B%0A%09apply
 (dep
@@ -709,19 +709,22 @@
 rce) %7B%0A%09
-var
+%09const
  used = 
@@ -764,211 +764,50 @@
 );%0A%09
-var content;%0A%09if(used)%0A%09%09content = %22/* harmony default export */ exports%5B%22 + JSON.stringify(used) + %22%5D = %22;%0A%09else%0A%09%09content = %22/* unused harmony default export */ var _unused_webpack_default_export = %22;%0A
+%09const content = this.getContent(used);%0A%0A%09
 %09if(
@@ -819,16 +819,17 @@
 ange) %7B%0A
+%09
 %09%09source
@@ -890,16 +890,17 @@
 ent);%0A%09%09
+%09
 source.r
@@ -958,16 +958,22 @@
 );%0A%09
-%7D else %7B
+%09%09return;%0A%09%09%7D%0A
 %0A%09%09s
@@ -1049,11 +1049,268 @@
 nt);%0A%09%7D%0A
-%7D
+%0A%09getContent(used) %7B%0A%09%09if(used) %7B%0A%09%09%09return %60/* harmony default export */ exports%5B$%7BJSON.stringify(used)%7D%5D = %60;%0A%09%09%7D%0A%09%09return %22/* unused harmony default export */ var _unused_webpack_default_export = %22;%0A%09%7D%0A%7D%0A%0Amodule.exports = HarmonyExportExpressionDependency
 ;%0A

refactor harmonyExportExpressionDependency to es6 (#3710)