UI for Zipcoin Blue

RequireEnsureDependenciesBlock.js 831B

1234567891011121314151617181920212223
  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 RequireEnsureDependency = require("./RequireEnsureDependency");
  8. module.exports = class RequireEnsureDependenciesBlock extends AsyncDependenciesBlock {
  9. constructor(expr, successExpression, errorExpression, chunkName, chunkNameRange, module, loc) {
  10. super(chunkName, module, loc);
  11. this.expr = expr;
  12. const successBodyRange = successExpression && successExpression.body && successExpression.body.range;
  13. if(successBodyRange) {
  14. this.range = [successBodyRange[0] + 1, successBodyRange[1] - 1];
  15. }
  16. this.chunkNameRange = chunkNameRange;
  17. const dep = new RequireEnsureDependency(this);
  18. dep.loc = loc;
  19. this.addDependency(dep);
  20. }
  21. };