How to use the scope-analyzer.visitScope function in scope-analyzer

To help you get started, we’ve selected a few scope-analyzer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goto-bus-stop / browser-pack-flat / index.js View on Github external
}, function (node) {
    if (node.type === 'Program') ast = node
    scan.visitScope(node)

    // also collect requires while we're here
    if (isRequire(node)) {
      var argument = node.arguments[0]
      var required = argument.type === 'Literal' ? argument.value : null

      if (required !== null && moduleExists(row.deps[required])) {
        var other = rows.byId[row.deps[required]]
        if (isOrderUnpredictable(node)) {
          if (!alreadyPredictablyEvaluated.has(other)) {
            other[kEvaluateOnDemand] = true
          }
        } else {
          alreadyPredictablyEvaluated.add(other)
        }
        requireCalls.push({

scope-analyzer

simple scope analysis for javascript ASTs

Apache-2.0
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis