選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AMDRequireDependenciesBlock.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
  7. const AMDRequireDependency = require("./AMDRequireDependency");
  8. module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBlock {
  9. constructor(
  10. expr,
  11. arrayRange,
  12. functionRange,
  13. errorCallbackRange,
  14. module,
  15. loc,
  16. request
  17. ) {
  18. super(null, module, loc, request);
  19. this.expr = expr;
  20. this.outerRange = expr.range;
  21. this.arrayRange = arrayRange;
  22. this.functionBindThis = false;
  23. this.functionRange = functionRange;
  24. this.errorCallbackBindThis = false;
  25. this.errorCallbackRange = errorCallbackRange;
  26. this.bindThis = true;
  27. if (arrayRange && functionRange && errorCallbackRange) {
  28. this.range = [arrayRange[0], errorCallbackRange[1]];
  29. } else if (arrayRange && functionRange) {
  30. this.range = [arrayRange[0], functionRange[1]];
  31. } else if (arrayRange) {
  32. this.range = arrayRange;
  33. } else if (functionRange) {
  34. this.range = functionRange;
  35. } else {
  36. this.range = expr.range;
  37. }
  38. const dep = this.newRequireDependency();
  39. dep.loc = loc;
  40. this.addDependency(dep);
  41. }
  42. newRequireDependency() {
  43. return new AMDRequireDependency(this);
  44. }
  45. };