a zip code crypto-currency system good for red ONLY

RequireIncludeDependencyParserPlugin.js 622B

12345678910111213141516171819202122
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const RequireIncludeDependency = require("./RequireIncludeDependency");
  7. module.exports = class RequireIncludeDependencyParserPlugin {
  8. apply(parser) {
  9. parser.plugin("call require.include", expr => {
  10. if(expr.arguments.length !== 1) return;
  11. const param = parser.evaluateExpression(expr.arguments[0]);
  12. if(!param.isString()) return;
  13. const dep = new RequireIncludeDependency(param.string, expr.range);
  14. dep.loc = expr.loc;
  15. parser.state.current.addDependency(dep);
  16. return true;
  17. });
  18. }
  19. };