clarity-pattern-parser 11.0.19 → 11.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3031,7 +3031,9 @@
3031
3031
  pattern = pattern.children[0];
3032
3032
  }
3033
3033
  if (pattern.type === "reference") {
3034
+ pattern.parent = this;
3034
3035
  pattern = pattern.getReferencePatternSafely();
3036
+ pattern.parent = null;
3035
3037
  }
3036
3038
  return pattern;
3037
3039
  }
@@ -3042,7 +3044,7 @@
3042
3044
  if (pattern == null) {
3043
3045
  return false;
3044
3046
  }
3045
- return pattern.type === "reference" && pattern.name === this.name;
3047
+ return pattern.name === this.name;
3046
3048
  }
3047
3049
  parse(cursor) {
3048
3050
  this._firstIndex = cursor.index;
@@ -3569,16 +3571,18 @@
3569
3571
  return this._isRecursivePattern(name, pattern);
3570
3572
  }
3571
3573
  _isRecursivePattern(name, pattern) {
3574
+ if (pattern.type === "reference") {
3575
+ return true;
3576
+ }
3572
3577
  if (pattern.children.length === 0) {
3573
3578
  return false;
3574
3579
  }
3575
3580
  const firstChild = pattern.children[0];
3576
3581
  const lastChild = pattern.children[pattern.children.length - 1];
3577
3582
  const isLongEnough = pattern.children.length >= 2;
3578
- return pattern.type === "reference" ||
3579
- (pattern.type === "sequence" && isLongEnough &&
3580
- (firstChild.type === "reference" && firstChild.name === name) ||
3581
- (lastChild.type === "reference" && lastChild.name === name));
3583
+ return (pattern.type === "sequence" && isLongEnough &&
3584
+ (firstChild.name === name) ||
3585
+ (lastChild.name === name));
3582
3586
  }
3583
3587
  _buildPattern(node) {
3584
3588
  const type = node.name;