hermes-parser 0.10.0 → 0.10.1

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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _visitorKeys = require("./generated/visitor-keys");
8
+ var _ParserVisitorKeys = require("./generated/ParserVisitorKeys");
9
9
 
10
10
  /**
11
11
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -17,15 +17,6 @@ var _visitorKeys = require("./generated/visitor-keys");
17
17
  * @format
18
18
  */
19
19
 
20
- /*
21
- This class does some very "javascripty" things in the name of
22
- performance which are ultimately impossible to soundly type.
23
-
24
- So instead of adding strict types and a large number of suppression
25
- comments, instead it is left untyped and subclasses are strictly
26
- typed via a separate flow declaration file.
27
- */
28
-
29
20
  /**
30
21
  * The base class for transforming the Hermes AST to the desired output format.
31
22
  * Extended by concrete adapters which output an ESTree or Babel AST.
@@ -79,18 +70,18 @@ class HermesASTAdapter {
79
70
  }
80
71
 
81
72
  mapNodeDefault(node) {
82
- const visitorKeys = _visitorKeys.HERMES_AST_VISITOR_KEYS[node.type];
73
+ const visitorKeys = _ParserVisitorKeys.HERMES_AST_VISITOR_KEYS[node.type];
83
74
 
84
75
  for (const key in visitorKeys) {
85
76
  const childType = visitorKeys[key];
86
77
 
87
- if (childType === _visitorKeys.NODE_CHILD) {
78
+ if (childType === _ParserVisitorKeys.NODE_CHILD) {
88
79
  const child = node[key];
89
80
 
90
81
  if (child != null) {
91
82
  node[key] = this.mapNode(child);
92
83
  }
93
- } else if (childType === _visitorKeys.NODE_LIST_CHILD) {
84
+ } else if (childType === _ParserVisitorKeys.NODE_LIST_CHILD) {
94
85
  const children = node[key];
95
86
 
96
87
  for (let i = 0; i < children.length; i++) {
@@ -4,19 +4,10 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
11
- /*
12
- This class does some very "javascripty" things in the name of
13
- performance which are ultimately impossible to soundly type.
14
-
15
- So instead of adding strict types and a large number of suppression
16
- comments, instead it is left untyped and subclasses are strictly
17
- typed via a separate flow declaration file.
18
- */
19
-
20
11
  import type {HermesNode} from './HermesAST';
21
12
  import type {ParserOptions} from './ParserOptions';
22
13
 
@@ -24,7 +15,7 @@ import {
24
15
  HERMES_AST_VISITOR_KEYS,
25
16
  NODE_CHILD,
26
17
  NODE_LIST_CHILD,
27
- } from './generated/visitor-keys';
18
+ } from './generated/ParserVisitorKeys';
28
19
 
29
20
  /**
30
21
  * The base class for transforming the Hermes AST to the desired output format.
@@ -18,7 +18,7 @@
18
18
 
19
19
  /* eslint no-undef: 'error', no-unused-vars: ['error', {vars: "local"}], no-redeclare: 'error' */
20
20
 
21
- /* global $NonMaybeType, $Partial, $ReadOnly, $ReadOnlyArray */
21
+ /* global $NonMaybeType, Partial, $ReadOnly, $ReadOnlyArray */
22
22
  'use strict';
23
23
 
24
24
  function deserializeEmpty() {