source: trip-planner-front/node_modules/@babel/traverse/lib/scope/binding.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[6a3a178]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8class Binding {
9 constructor({
10 identifier,
11 scope,
12 path,
13 kind
14 }) {
15 this.identifier = void 0;
16 this.scope = void 0;
17 this.path = void 0;
18 this.kind = void 0;
19 this.constantViolations = [];
20 this.constant = true;
21 this.referencePaths = [];
22 this.referenced = false;
23 this.references = 0;
24 this.identifier = identifier;
25 this.scope = scope;
26 this.path = path;
27 this.kind = kind;
28 this.clearValue();
29 }
30
31 deoptValue() {
32 this.clearValue();
33 this.hasDeoptedValue = true;
34 }
35
36 setValue(value) {
37 if (this.hasDeoptedValue) return;
38 this.hasValue = true;
39 this.value = value;
40 }
41
42 clearValue() {
43 this.hasDeoptedValue = false;
44 this.hasValue = false;
45 this.value = null;
46 }
47
48 reassign(path) {
49 this.constant = false;
50
51 if (this.constantViolations.indexOf(path) !== -1) {
52 return;
53 }
54
55 this.constantViolations.push(path);
56 }
57
58 reference(path) {
59 if (this.referencePaths.indexOf(path) !== -1) {
60 return;
61 }
62
63 this.referenced = true;
64 this.references++;
65 this.referencePaths.push(path);
66 }
67
68 dereference() {
69 this.references--;
70 this.referenced = !!this.references;
71 }
72
73}
74
75exports.default = Binding;
Note: See TracBrowser for help on using the repository browser.