1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/@babel/traverse/lib/scope/binding.js

73 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
2024-01-16 21:26:16 +08:00
var Binding = function () {
function Binding(_ref) {
var identifier = _ref.identifier,
scope = _ref.scope,
path = _ref.path,
kind = _ref.kind;
2023-12-18 13:12:25 +08:00
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();
}
2024-01-16 21:26:16 +08:00
var _proto = Binding.prototype;
_proto.deoptValue = function deoptValue() {
2023-12-18 13:12:25 +08:00
this.clearValue();
this.hasDeoptedValue = true;
2024-01-16 21:26:16 +08:00
};
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
_proto.setValue = function setValue(value) {
2023-12-18 13:12:25 +08:00
if (this.hasDeoptedValue) return;
this.hasValue = true;
this.value = value;
2024-01-16 21:26:16 +08:00
};
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
_proto.clearValue = function clearValue() {
2023-12-18 13:12:25 +08:00
this.hasDeoptedValue = false;
this.hasValue = false;
this.value = null;
2024-01-16 21:26:16 +08:00
};
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
_proto.reassign = function reassign(path) {
2023-12-18 13:12:25 +08:00
this.constant = false;
if (this.constantViolations.indexOf(path) !== -1) {
return;
}
this.constantViolations.push(path);
2024-01-16 21:26:16 +08:00
};
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
_proto.reference = function reference(path) {
2023-12-18 13:12:25 +08:00
if (this.referencePaths.indexOf(path) !== -1) {
return;
}
this.referenced = true;
this.references++;
this.referencePaths.push(path);
2024-01-16 21:26:16 +08:00
};
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
_proto.dereference = function dereference() {
2023-12-18 13:12:25 +08:00
this.references--;
this.referenced = !!this.references;
2024-01-16 21:26:16 +08:00
};
2023-12-18 13:12:25 +08:00
2024-01-16 21:26:16 +08:00
return Binding;
}();
2023-12-18 13:12:25 +08:00
exports.default = Binding;