clarity-pattern-parser 9.2.1 → 9.2.3

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.
@@ -915,8 +915,8 @@
915
915
  }
916
916
  const children = clonePatterns(options);
917
917
  this._assignChildrenToParent(children);
918
- this._id = `or-${idIndex$6++}`;
919
- this._type = "or";
918
+ this._id = `options-${idIndex$6++}`;
919
+ this._type = "options";
920
920
  this._name = name;
921
921
  this._parent = null;
922
922
  this._children = children;
@@ -2058,7 +2058,8 @@
2058
2058
 
2059
2059
  const bodyLineContent = new Options("body-line-content", [
2060
2060
  comment,
2061
- statement
2061
+ statement,
2062
+ lineSpaces$1
2062
2063
  ]);
2063
2064
  const optionalLineSpaces$2 = new Optional("optional-line-spaces", lineSpaces$1);
2064
2065
  const bodyLine = new Sequence("body-line", [
@@ -2101,7 +2102,7 @@
2101
2102
  optionalLineSpaces$1,
2102
2103
  openBracket,
2103
2104
  optionalSpaces$1,
2104
- body.clone("with-params-body"),
2105
+ body,
2105
2106
  optionalSpaces$1,
2106
2107
  closeBracket
2107
2108
  ]));
@@ -2554,11 +2555,12 @@
2554
2555
  return importBlock && importBlock.children.length > 0;
2555
2556
  }
2556
2557
  _buildPatterns(ast) {
2557
- const body = ast.find(n => n.name === "body");
2558
+ const body = ast.find(n => n.name === "body" && n.findAncester(n => n.name === "head") == null);
2558
2559
  if (body == null) {
2559
2560
  return;
2560
2561
  }
2561
- body.findAll(n => n.name === "assign-statement").forEach((n) => {
2562
+ const statements = body.findAll(n => n.name === "assign-statement");
2563
+ statements.forEach((n) => {
2562
2564
  const patternNode = n.children.find(n => patternNodes[n.name] != null);
2563
2565
  if (patternNode == null) {
2564
2566
  return;
@@ -2820,7 +2822,7 @@
2820
2822
  let params = [];
2821
2823
  const paramsStatement = importStatement.find(n => n.name === "with-params-statement");
2822
2824
  if (paramsStatement != null) {
2823
- const statements = paramsStatement.find(n => n.name === "with-params-body");
2825
+ const statements = paramsStatement.find(n => n.name === "body");
2824
2826
  if (statements != null) {
2825
2827
  const expression = statements.toString();
2826
2828
  const importedValues = Array.from(this