项目原始demo,不改动
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
Dieses Repo ist archiviert. Du kannst Dateien sehen und es klonen, kannst aber nicht pushen oder Issues/Pull-Requests öffnen.
 
 
 
 

73 Zeilen
1.5 KiB

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var Binding = function () {
  7. function Binding(_ref) {
  8. var identifier = _ref.identifier,
  9. scope = _ref.scope,
  10. path = _ref.path,
  11. kind = _ref.kind;
  12. this.identifier = identifier;
  13. this.scope = scope;
  14. this.path = path;
  15. this.kind = kind;
  16. this.constantViolations = [];
  17. this.constant = true;
  18. this.referencePaths = [];
  19. this.referenced = false;
  20. this.references = 0;
  21. this.clearValue();
  22. }
  23. var _proto = Binding.prototype;
  24. _proto.deoptValue = function deoptValue() {
  25. this.clearValue();
  26. this.hasDeoptedValue = true;
  27. };
  28. _proto.setValue = function setValue(value) {
  29. if (this.hasDeoptedValue) return;
  30. this.hasValue = true;
  31. this.value = value;
  32. };
  33. _proto.clearValue = function clearValue() {
  34. this.hasDeoptedValue = false;
  35. this.hasValue = false;
  36. this.value = null;
  37. };
  38. _proto.reassign = function reassign(path) {
  39. this.constant = false;
  40. if (this.constantViolations.indexOf(path) !== -1) {
  41. return;
  42. }
  43. this.constantViolations.push(path);
  44. };
  45. _proto.reference = function reference(path) {
  46. if (this.referencePaths.indexOf(path) !== -1) {
  47. return;
  48. }
  49. this.referenced = true;
  50. this.references++;
  51. this.referencePaths.push(path);
  52. };
  53. _proto.dereference = function dereference() {
  54. this.references--;
  55. this.referenced = !!this.references;
  56. };
  57. return Binding;
  58. }();
  59. exports.default = Binding;