Skip to content

Commit 0e90586

Browse files
ritikrishuTheLarkInn
authored andcommitted
refactoring AMDRequireDependenciesBlock to es6 syntax (webpack#3832)
1 parent bb31c25 commit 0e90586

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

lib/dependencies/AMDRequireDependenciesBlock.js

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,32 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
var AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
6-
var AMDRequireDependency = require("./AMDRequireDependency");
5+
"use strict";
6+
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
7+
const AMDRequireDependency = require("./AMDRequireDependency");
78

8-
function AMDRequireDependenciesBlock(expr, arrayRange, functionRange, errorCallbackRange, module, loc) {
9-
AsyncDependenciesBlock.call(this, null, module, loc);
10-
this.expr = expr;
11-
this.outerRange = expr.range;
12-
this.arrayRange = arrayRange;
13-
this.functionRange = functionRange;
14-
this.errorCallbackRange = errorCallbackRange;
15-
this.bindThis = true;
16-
if(arrayRange && functionRange && errorCallbackRange) {
17-
this.range = [arrayRange[0], errorCallbackRange[1]];
18-
} else if(arrayRange && functionRange) {
19-
this.range = [arrayRange[0], functionRange[1]];
20-
} else if(arrayRange) {
21-
this.range = arrayRange;
22-
} else if(functionRange) {
23-
this.range = functionRange;
24-
} else {
25-
this.range = expr.range;
9+
module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBlock {
10+
constructor(expr, arrayRange, functionRange, errorCallbackRange, module, loc) {
11+
super(null, module, loc);
12+
this.expr = expr;
13+
this.outerRange = expr.range;
14+
this.arrayRange = arrayRange;
15+
this.functionRange = functionRange;
16+
this.errorCallbackRange = errorCallbackRange;
17+
this.bindThis = true;
18+
if(arrayRange && functionRange && errorCallbackRange) {
19+
this.range = [arrayRange[0], errorCallbackRange[1]];
20+
} else if(arrayRange && functionRange) {
21+
this.range = [arrayRange[0], functionRange[1]];
22+
} else if(arrayRange) {
23+
this.range = arrayRange;
24+
} else if(functionRange) {
25+
this.range = functionRange;
26+
} else {
27+
this.range = expr.range;
28+
}
29+
let dep = new AMDRequireDependency(this);
30+
dep.loc = loc;
31+
this.addDependency(dep);
2632
}
27-
var dep = new AMDRequireDependency(this);
28-
dep.loc = loc;
29-
this.addDependency(dep);
3033
}
31-
module.exports = AMDRequireDependenciesBlock;
32-
33-
AMDRequireDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype);
34-
AMDRequireDependenciesBlock.prototype.constructor = AMDRequireDependenciesBlock;

0 commit comments

Comments
 (0)