Sha256: 219e24d44a95f2a11bc2358be4d0e9d275620617368d4b80d33ccc3c154b228e

Contents?: true

Size: 1.2 KB

Versions: 49

Compression:

Stored size: 1.2 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

class Binding {
  constructor({
    identifier,
    scope,
    path,
    kind
  }) {
    this.identifier = identifier;
    this.scope = scope;
    this.path = path;
    this.kind = kind;
    this.constantViolations = [];
    this.constant = true;
    this.referencePaths = [];
    this.referenced = false;
    this.references = 0;
    this.clearValue();
  }

  deoptValue() {
    this.clearValue();
    this.hasDeoptedValue = true;
  }

  setValue(value) {
    if (this.hasDeoptedValue) return;
    this.hasValue = true;
    this.value = value;
  }

  clearValue() {
    this.hasDeoptedValue = false;
    this.hasValue = false;
    this.value = null;
  }

  reassign(path) {
    this.constant = false;

    if (this.constantViolations.indexOf(path) !== -1) {
      return;
    }

    this.constantViolations.push(path);
  }

  reference(path) {
    if (this.referencePaths.indexOf(path) !== -1) {
      return;
    }

    this.referenced = true;
    this.references++;
    this.referencePaths.push(path);
  }

  dereference() {
    this.references--;
    this.referenced = !!this.references;
  }

}

exports.default = Binding;

Version data entries

49 entries across 49 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@babel/traverse/lib/scope/binding.js
disco_app-0.18.0 test/dummy/node_modules/@babel/traverse/lib/scope/binding.js
disco_app-0.18.2 test/dummy/node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.7 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.6 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.5 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.4 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.3 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.2 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.1 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.3.5 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-5.0.0 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.3.4 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.3.3 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.3.2 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.3.1 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.3 node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.2.3 node_modules/@babel/traverse/lib/scope/binding.js
tang-0.2.1 spec/tang_app/node_modules/@babel/traverse/lib/scope/binding.js
trusty-cms-4.2.2 node_modules/@babel/traverse/lib/scope/binding.js