@abaplint/cli 2.119.57 → 2.119.58

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.
Files changed (2) hide show
  1. package/build/cli.js +40 -23
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -24748,16 +24748,20 @@ class BuiltIn {
24748
24748
  return def.predicate;
24749
24749
  }
24750
24750
  getTypes() {
24751
- const ret = this.buildSY();
24752
- {
24753
- const id = new tokens_1.Identifier(new position_1.Position(1, 1), "abap_bool");
24754
- ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" })));
24755
- }
24756
- {
24757
- const id = new tokens_1.Identifier(new position_1.Position(1, 1), "cursor");
24758
- ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, basic_1.IntegerType.get({ qualifiedName: "CURSOR", ddicName: "CURSOR" })));
24751
+ // the identifiers are identical for every object, share them to reduce memory usage
24752
+ if (BuiltIn.typesCache === undefined) {
24753
+ const ret = this.buildSY();
24754
+ {
24755
+ const id = new tokens_1.Identifier(new position_1.Position(1, 1), "abap_bool");
24756
+ ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" })));
24757
+ }
24758
+ {
24759
+ const id = new tokens_1.Identifier(new position_1.Position(1, 1), "cursor");
24760
+ ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, basic_1.IntegerType.get({ qualifiedName: "CURSOR", ddicName: "CURSOR" })));
24761
+ }
24762
+ BuiltIn.typesCache = ret;
24759
24763
  }
24760
- return ret;
24764
+ return BuiltIn.typesCache;
24761
24765
  }
24762
24766
  get(extras) {
24763
24767
  const ret = [];
@@ -24790,10 +24794,17 @@ class BuiltIn {
24790
24794
  BuiltIn.getCache.push(this.buildConstant("space", new basic_1.CharacterType(1, { derivedFromConstant: true }), "' '"));
24791
24795
  }
24792
24796
  ret.push(...BuiltIn.getCache);
24793
- for (const e of extras) {
24794
- const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), e);
24795
- ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, basic_1.VoidType.get(e), ["read_only" /* IdentifierMeta.ReadOnly */, "built-in" /* IdentifierMeta.BuiltIn */], "'?'"));
24797
+ // the extras are identical for every object, share them to reduce memory usage
24798
+ const key = extras.join("|");
24799
+ if (key !== BuiltIn.extrasCacheKey) {
24800
+ BuiltIn.extrasCacheKey = key;
24801
+ BuiltIn.extrasCache = [];
24802
+ for (const e of extras) {
24803
+ const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), e);
24804
+ BuiltIn.extrasCache.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, basic_1.VoidType.get(e), ["read_only" /* IdentifierMeta.ReadOnly */, "built-in" /* IdentifierMeta.BuiltIn */], "'?'"));
24805
+ }
24796
24806
  }
24807
+ ret.push(...BuiltIn.extrasCache);
24797
24808
  return ret;
24798
24809
  }
24799
24810
  /////////////////////////////
@@ -25002,6 +25013,9 @@ exports.BuiltIn = BuiltIn;
25002
25013
  BuiltIn.filename = "_builtin.prog.abap";
25003
25014
  BuiltIn.counter = 1;
25004
25015
  BuiltIn.getCache = [];
25016
+ BuiltIn.typesCache = undefined;
25017
+ BuiltIn.extrasCacheKey = undefined;
25018
+ BuiltIn.extrasCache = [];
25005
25019
  // todo: "pcre" vs "regex", only one of these parameters are allowed
25006
25020
  // todo: "pcre", only possible from 755
25007
25021
  BuiltIn.methods = {
@@ -47867,15 +47881,21 @@ exports.CrossIncludeMacros = CrossIncludeMacros;
47867
47881
 
47868
47882
  Object.defineProperty(exports, "__esModule", ({ value: true }));
47869
47883
  exports.AbstractNode = void 0;
47884
+ // shared constant, so nodes without children don't waste memory on empty arrays
47885
+ const EMPTY = Object.freeze([]);
47870
47886
  class AbstractNode {
47871
47887
  constructor() {
47872
- this.children = [];
47888
+ this.children = EMPTY;
47873
47889
  }
47874
47890
  addChild(n) {
47891
+ if (this.children === EMPTY) {
47892
+ this.children = [];
47893
+ }
47875
47894
  this.children.push(n);
47876
47895
  }
47877
47896
  setChildren(children) {
47878
- this.children = children;
47897
+ // copy, input arrays are built via push() and carry over-allocated backing stores
47898
+ this.children = children.slice();
47879
47899
  }
47880
47900
  getChildren() {
47881
47901
  return this.children;
@@ -48231,17 +48251,13 @@ const string_template_middle_1 = __webpack_require__(/*! ../1_lexer/tokens/strin
48231
48251
  const string_template_end_1 = __webpack_require__(/*! ../1_lexer/tokens/string_template_end */ "../core/build/src/abap/1_lexer/tokens/string_template_end.js");
48232
48252
  const string_template_begin_1 = __webpack_require__(/*! ../1_lexer/tokens/string_template_begin */ "../core/build/src/abap/1_lexer/tokens/string_template_begin.js");
48233
48253
  const string_template_1 = __webpack_require__(/*! ../1_lexer/tokens/string_template */ "../core/build/src/abap/1_lexer/tokens/string_template.js");
48254
+ const EMPTY_PRAGMAS = Object.freeze([]);
48234
48255
  class StatementNode extends _abstract_node_1.AbstractNode {
48235
48256
  constructor(statement, colon, pragmas) {
48236
48257
  super();
48237
48258
  this.statement = statement;
48238
48259
  this.colon = colon;
48239
- if (pragmas) {
48240
- this.pragmas = pragmas;
48241
- }
48242
- else {
48243
- this.pragmas = [];
48244
- }
48260
+ this.pragmas = pragmas !== null && pragmas !== void 0 ? pragmas : EMPTY_PRAGMAS;
48245
48261
  }
48246
48262
  get() {
48247
48263
  return this.statement;
@@ -48256,7 +48272,7 @@ class StatementNode extends _abstract_node_1.AbstractNode {
48256
48272
  if (children.length === 0) {
48257
48273
  throw new Error("statement: zero children");
48258
48274
  }
48259
- this.children = children;
48275
+ super.setChildren(children);
48260
48276
  return this;
48261
48277
  }
48262
48278
  getStart() {
@@ -48837,6 +48853,7 @@ exports.StructureNode = StructureNode;
48837
48853
 
48838
48854
  Object.defineProperty(exports, "__esModule", ({ value: true }));
48839
48855
  exports.TokenNode = void 0;
48856
+ const EMPTY_CHILDREN = Object.freeze([]);
48840
48857
  class TokenNode {
48841
48858
  constructor(token) {
48842
48859
  this.token = token;
@@ -48848,7 +48865,7 @@ class TokenNode {
48848
48865
  throw new Error("TokenNode, Method not implemented.");
48849
48866
  }
48850
48867
  getChildren() {
48851
- return [];
48868
+ return EMPTY_CHILDREN;
48852
48869
  }
48853
48870
  concatTokens() {
48854
48871
  return this.token.getStr();
@@ -68667,7 +68684,7 @@ class Registry {
68667
68684
  }
68668
68685
  static abaplintVersion() {
68669
68686
  // magic, see build script "version.js"
68670
- return "2.119.57";
68687
+ return "2.119.58";
68671
68688
  }
68672
68689
  getDDICReferences() {
68673
68690
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.119.57",
3
+ "version": "2.119.58",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.119.57",
42
+ "@abaplint/core": "^2.119.58",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",