|
2 | 2 | MIT License http://www.opensource.org/licenses/mit-license.php |
3 | 3 | Author Tobias Koppers @sokra |
4 | 4 | */ |
5 | | -var AsyncDependenciesBlock = require("../AsyncDependenciesBlock"); |
6 | | -var AMDRequireDependency = require("./AMDRequireDependency"); |
| 5 | +"use strict"; |
| 6 | +const AsyncDependenciesBlock = require("../AsyncDependenciesBlock"); |
| 7 | +const AMDRequireDependency = require("./AMDRequireDependency"); |
7 | 8 |
|
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); |
26 | 32 | } |
27 | | - var dep = new AMDRequireDependency(this); |
28 | | - dep.loc = loc; |
29 | | - this.addDependency(dep); |
30 | 33 | } |
31 | | -module.exports = AMDRequireDependenciesBlock; |
32 | | - |
33 | | -AMDRequireDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype); |
34 | | -AMDRequireDependenciesBlock.prototype.constructor = AMDRequireDependenciesBlock; |
0 commit comments