@ohm-js/wasm 0.6.14 → 0.6.15

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.
@@ -71,6 +71,7 @@ export interface TerminalNode extends CstNodeBase {
71
71
  type: typeof CstNodeType.TERMINAL;
72
72
  ctorName: '_terminal';
73
73
  leadingSpaces?: NonterminalNode;
74
+ children: readonly [];
74
75
  value: string;
75
76
  }
76
77
  export interface ListNode<TNode extends CstNode = CstNode> extends CstNodeBase {
@@ -15,6 +15,7 @@ export const CstNodeType = {
15
15
  OPT: 3,
16
16
  SEQ: 4,
17
17
  };
18
+ const EMPTY_CHILDREN = Object.freeze([]);
18
19
  const compileOptions = {
19
20
  builtins: ['js-string'],
20
21
  };
@@ -261,6 +262,9 @@ export class CstNodeImpl {
261
262
  startIdx,
262
263
  endIdx: startIdx + this.sourceString.length,
263
264
  };
265
+ if (this.matchRecordType === MatchRecordType.TERMINAL || this.count === 0) {
266
+ this._children = EMPTY_CHILDREN;
267
+ }
264
268
  }
265
269
  get type() {
266
270
  switch (this._typeAndDetails & MATCH_RECORD_TYPE_MASK) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohm-js/wasm",
3
- "version": "0.6.14",
3
+ "version": "0.6.15",
4
4
  "description": "Compile Ohm.js grammars to WebAsssembly",
5
5
  "main": "dist/index.js",
6
6
  "exports": {