@abaplint/transpiler-cli 2.13.38 → 2.13.39

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/bundle.js +188 -116
  2. package/package.json +3 -3
package/build/bundle.js CHANGED
@@ -2819,24 +2819,14 @@ class Expression {
2819
2819
  for (const input of r) {
2820
2820
  const temp = this.runnable.run([input]);
2821
2821
  for (const t of temp) {
2822
- let consumed = input.remainingLength() - t.remainingLength();
2822
+ const consumed = input.remainingLength() - t.remainingLength();
2823
2823
  if (consumed > 0) {
2824
- const originalLength = t.getNodes().length;
2825
- const children = [];
2826
- while (consumed > 0) {
2827
- const sub = t.popNode();
2828
- if (sub) {
2829
- children.push(sub);
2830
- consumed = consumed - sub.countTokens();
2831
- }
2832
- }
2833
2824
  const re = new nodes_1.ExpressionNode(this);
2834
- re.setChildren(children.reverse());
2835
- const n = t.getNodes().slice(0, originalLength - consumed);
2836
- n.push(re);
2837
- t.setNodes(n);
2825
+ results.push(t.wrapConsumed(consumed, re));
2826
+ }
2827
+ else {
2828
+ results.push(t);
2838
2829
  }
2839
- results.push(t);
2840
2830
  }
2841
2831
  }
2842
2832
  // console.dir(results);
@@ -11563,11 +11553,17 @@ class Result {
11563
11553
  // nodes: matched tokens
11564
11554
  this.tokens = tokens;
11565
11555
  this.tokenIndex = tokenIndex;
11566
- this.nodes = nodes;
11567
- if (this.nodes === undefined) {
11568
- this.nodes = [];
11556
+ this.nodeCount = 0;
11557
+ if (nodes !== undefined) {
11558
+ this.setNodes(nodes);
11569
11559
  }
11570
11560
  }
11561
+ static fromChain(tokens, tokenIndex, nodes, nodeCount) {
11562
+ const ret = new Result(tokens, tokenIndex);
11563
+ ret.nodes = nodes;
11564
+ ret.nodeCount = nodeCount;
11565
+ return ret;
11566
+ }
11571
11567
  peek() {
11572
11568
  return this.tokens[this.tokenIndex];
11573
11569
  }
@@ -11575,18 +11571,54 @@ class Result {
11575
11571
  return this.tokens[this.tokenIndex + offset];
11576
11572
  }
11577
11573
  shift(node) {
11578
- const cp = this.nodes.slice();
11579
- cp.push(node);
11580
- return new Result(this.tokens, this.tokenIndex + 1, cp);
11574
+ return Result.fromChain(this.tokens, this.tokenIndex + 1, { node, previous: this.nodes }, this.nodeCount + 1);
11575
+ }
11576
+ wrapConsumed(consumedTokens, node) {
11577
+ let current = this.nodes;
11578
+ let currentCount = this.nodeCount;
11579
+ const children = [];
11580
+ while (consumedTokens > 0) {
11581
+ if (current === undefined) {
11582
+ break;
11583
+ }
11584
+ children.push(current.node);
11585
+ consumedTokens = consumedTokens - current.node.countTokens();
11586
+ current = current.previous;
11587
+ currentCount--;
11588
+ }
11589
+ node.setChildren(children.reverse());
11590
+ this.nodes = { node, previous: current };
11591
+ this.nodeCount = currentCount + 1;
11592
+ return this;
11581
11593
  }
11582
11594
  popNode() {
11583
- return this.nodes.pop();
11595
+ if (this.nodes === undefined) {
11596
+ return undefined;
11597
+ }
11598
+ const ret = this.nodes.node;
11599
+ this.nodes = this.nodes.previous;
11600
+ this.nodeCount--;
11601
+ return ret;
11584
11602
  }
11585
11603
  getNodes() {
11586
- return this.nodes;
11604
+ const ret = new Array(this.nodeCount);
11605
+ let current = this.nodes;
11606
+ for (let index = this.nodeCount - 1; index >= 0; index--) {
11607
+ if (current === undefined) {
11608
+ break;
11609
+ }
11610
+ ret[index] = current.node;
11611
+ current = current.previous;
11612
+ }
11613
+ return ret;
11587
11614
  }
11588
11615
  setNodes(n) {
11589
- this.nodes = n;
11616
+ this.nodes = undefined;
11617
+ this.nodeCount = 0;
11618
+ for (const node of n) {
11619
+ this.nodes = { node, previous: this.nodes };
11620
+ this.nodeCount++;
11621
+ }
11590
11622
  }
11591
11623
  getTokens() {
11592
11624
  return this.tokens;
@@ -11851,7 +11883,9 @@ class StatementParser {
11851
11883
  statement = input;
11852
11884
  }
11853
11885
  else if (length === 1 && lastToken instanceof tokens_1.Pragma) {
11854
- statement = new nodes_1.StatementNode(new _statement_1.Empty(), undefined, [lastToken]);
11886
+ // special case, everything crashes if StatementNodes doesnt have children
11887
+ statement = new nodes_1.StatementNode(new _statement_1.Empty(), undefined, [lastToken])
11888
+ .setChildren(this.tokensToNodes([lastToken]));
11855
11889
  }
11856
11890
  }
11857
11891
  return statement;
@@ -20240,7 +20274,7 @@ class TypeMesh {
20240
20274
  const on = (0, combi_1.seq)("ON", expressions_1.NamespaceSimpleName, "=", expressions_1.NamespaceSimpleName, (0, combi_1.star)((0, combi_1.seq)("AND", expressions_1.NamespaceSimpleName, "=", expressions_1.NamespaceSimpleName)));
20241
20275
  const using = (0, combi_1.seq)("USING KEY", expressions_1.NamespaceSimpleName);
20242
20276
  const association = (0, combi_1.seq)("ASSOCIATION", expressions_1.NamespaceSimpleName, "TO", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(on));
20243
- const ret = (0, combi_1.ver)(version_1.Release.v751, (0, combi_1.seq)("TYPES", expressions_1.NamespaceSimpleName, "TYPE", (0, combi_1.opt)("REF TO"), expressions_1.TypeName, (0, combi_1.plus)(association), (0, combi_1.opt)(using)));
20277
+ const ret = (0, combi_1.ver)(version_1.Release.v740sp05, (0, combi_1.seq)("TYPES", expressions_1.NamespaceSimpleName, "TYPE", (0, combi_1.opt)("REF TO"), expressions_1.TypeName, (0, combi_1.plus)(association), (0, combi_1.opt)(using)));
20244
20278
  return ret;
20245
20279
  }
20246
20280
  }
@@ -26642,7 +26676,7 @@ class CurrentScope {
26642
26676
  }
26643
26677
  findTypePoolConstant(name) {
26644
26678
  var _a;
26645
- if (name === undefined || name.includes("_") === undefined) {
26679
+ if (name === undefined || name.includes("_") === false) {
26646
26680
  return undefined;
26647
26681
  }
26648
26682
  const typePoolName = name.split("_")[0];
@@ -26664,7 +26698,7 @@ class CurrentScope {
26664
26698
  }
26665
26699
  findTypePoolType(name) {
26666
26700
  var _a;
26667
- if (name.includes("_") === undefined) {
26701
+ if (name.includes("_") === false) {
26668
26702
  return undefined;
26669
26703
  }
26670
26704
  const typePoolName = name.split("_")[0];
@@ -26978,11 +27012,9 @@ class ObjectOriented {
26978
27012
  findMethodInInterface(interfaceName, methodName) {
26979
27013
  const idef = this.scope.findInterfaceDefinition(interfaceName);
26980
27014
  if (idef) {
26981
- const methods = idef.getMethodDefinitions().getAll();
26982
- for (const method of methods) {
26983
- if (method.getName().toUpperCase() === methodName.toUpperCase()) {
26984
- return { method, def: idef };
26985
- }
27015
+ const method = idef.getMethodDefinitions().getByName(methodName);
27016
+ if (method) {
27017
+ return { method, def: idef };
26986
27018
  }
26987
27019
  return this.findMethodViaAlias(methodName, idef);
26988
27020
  }
@@ -27204,17 +27236,14 @@ class ObjectOriented {
27204
27236
  if (defs === undefined) {
27205
27237
  return undefined;
27206
27238
  }
27207
- for (const method of defs.getAll()) {
27208
- if (method.getName().toUpperCase() === methodName.toUpperCase()) {
27209
- if (method.isRedefinition()) {
27210
- return this.findMethodInSuper(def, methodName);
27211
- }
27212
- else {
27213
- return method;
27214
- }
27215
- }
27239
+ const method = defs.getByName(methodName);
27240
+ if (method === undefined) {
27241
+ return undefined;
27216
27242
  }
27217
- return undefined;
27243
+ if (method.isRedefinition()) {
27244
+ return this.findMethodInSuper(def, methodName);
27245
+ }
27246
+ return method;
27218
27247
  }
27219
27248
  findMethodInSuper(child, methodName) {
27220
27249
  let sup = child.getSuperClass();
@@ -34584,6 +34613,9 @@ class Source {
34584
34613
  if (context instanceof basic_1.FloatType && found instanceof basic_1.IntegerType) {
34585
34614
  return context;
34586
34615
  }
34616
+ else if (context instanceof basic_1.IntegerType && found instanceof basic_1.HexType) {
34617
+ return context;
34618
+ }
34587
34619
  else if ((context instanceof basic_1.IntegerType || context instanceof basic_1.FloatType) && (found === null || found === void 0 ? void 0 : found.isGeneric())) {
34588
34620
  return context;
34589
34621
  }
@@ -39378,18 +39410,25 @@ class DeleteInternal {
39378
39410
  let targetType = undefined;
39379
39411
  const target = node.findDirectExpression(Expressions.Target);
39380
39412
  if (target) {
39413
+ const targetName = target.concatTokens();
39381
39414
  let tabl = undefined;
39382
- const localVariable = input.scope.findVariable(target.concatTokens());
39415
+ const localVariable = input.scope.findVariable(targetName);
39383
39416
  if (localVariable === undefined && node.getChildren().length === 5 && node.getChildren()[2].concatTokens().toUpperCase() === "FROM") {
39384
39417
  // it might be a database table
39385
- const found = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(target.concatTokens());
39418
+ const found = (_a = input.scope.getDDIC()) === null || _a === void 0 ? void 0 : _a.lookupTableOrView(targetName);
39386
39419
  if ((found === null || found === void 0 ? void 0 : found.object) !== undefined) {
39387
39420
  tabl = found;
39388
39421
  input.scope.getDDICReferences().addUsing(input.scope.getParentObj(), { object: tabl.object });
39389
39422
  }
39390
39423
  }
39391
39424
  if (tabl === undefined) {
39392
- targetType = target_1.Target.runSyntax(target, input);
39425
+ const ambigiousVoids = input.scope.getRegistry().getConfig().getSyntaxSetttings().ambigiousVoids || [];
39426
+ if (ambigiousVoids.some(name => name.toUpperCase() === targetName.toUpperCase())) {
39427
+ targetType = basic_1.VoidType.get(targetName);
39428
+ }
39429
+ else {
39430
+ targetType = target_1.Target.runSyntax(target, input);
39431
+ }
39393
39432
  if (node.findDirectTokenByText("TABLE") === undefined
39394
39433
  && node.findDirectTokenByText("ADJACENT") === undefined
39395
39434
  && (node.findDirectTokenByText("FROM") || node.findDirectTokenByText("INDEX"))
@@ -51078,6 +51117,8 @@ class Attributes {
51078
51117
  this.tlist = [];
51079
51118
  this.filename = input.filename;
51080
51119
  this.parse(node, input);
51120
+ this.all = this.static.concat(this.instance);
51121
+ this.byName = this.buildByName();
51081
51122
  this.types = new type_definitions_1.TypeDefinitions(this.tlist);
51082
51123
  }
51083
51124
  getTypes() {
@@ -51090,10 +51131,7 @@ class Attributes {
51090
51131
  return this.aliases;
51091
51132
  }
51092
51133
  getAll() {
51093
- let res = [];
51094
- res = res.concat(this.static);
51095
- res = res.concat(this.instance);
51096
- return res;
51134
+ return this.all;
51097
51135
  }
51098
51136
  getStaticsByVisibility(visibility) {
51099
51137
  const attributes = [];
@@ -51128,27 +51166,29 @@ class Attributes {
51128
51166
  }
51129
51167
  return attributes;
51130
51168
  }
51131
- // todo, optimize
51132
51169
  findByName(name) {
51133
- const upper = name.toUpperCase();
51134
- for (const a of this.getStatic()) {
51135
- if (a.getName().toUpperCase() === upper) {
51136
- return a;
51137
- }
51170
+ return this.byName[name.toUpperCase()];
51171
+ }
51172
+ /////////////////////////////
51173
+ buildByName() {
51174
+ const ret = {};
51175
+ for (const a of this.static) {
51176
+ ret[a.getName().toUpperCase()] = a;
51138
51177
  }
51139
- for (const a of this.getInstance()) {
51140
- if (a.getName().toUpperCase() === upper) {
51141
- return a;
51178
+ for (const a of this.instance) {
51179
+ const name = a.getName().toUpperCase();
51180
+ if (ret[name] === undefined) {
51181
+ ret[name] = a;
51142
51182
  }
51143
51183
  }
51144
- for (const a of this.getConstants()) {
51145
- if (a.getName().toUpperCase() === upper) {
51146
- return a;
51184
+ for (const a of this.constants) {
51185
+ const name = a.getName().toUpperCase();
51186
+ if (ret[name] === undefined) {
51187
+ ret[name] = a;
51147
51188
  }
51148
51189
  }
51149
- return undefined;
51190
+ return ret;
51150
51191
  }
51151
- /////////////////////////////
51152
51192
  parse(node, input) {
51153
51193
  var _a, _b;
51154
51194
  const cdef = node.findDirectStructure(Structures.ClassDefinition);
@@ -54925,10 +54965,19 @@ class Config {
54925
54965
  for (const rule of sorted) {
54926
54966
  rules[rule.getMetadata().key] = rule.getConfig();
54927
54967
  }
54928
- const version = ver !== null && ver !== void 0 ? ver : {
54929
- release: version_1.Release.Newest.name,
54930
- language: langVer !== null && langVer !== void 0 ? langVer : version_1.LanguageVersion.Normal,
54931
- };
54968
+ const version = langVer !== undefined
54969
+ ? {
54970
+ release: ver === undefined || ver === version_1.Version.Cloud
54971
+ ? version_1.Release.Newest.name
54972
+ : typeof ver === "string"
54973
+ ? (0, version_1.versionToABAPRelease)(ver).name
54974
+ : ver.release,
54975
+ language: langVer,
54976
+ }
54977
+ : ver !== null && ver !== void 0 ? ver : {
54978
+ release: version_1.Release.Newest.name,
54979
+ language: version_1.LanguageVersion.Normal,
54980
+ };
54932
54981
  // defaults: dont skip anything, report everything. The user can decide to skip stuff
54933
54982
  // its difficult to debug errors not being reported
54934
54983
  const config = {
@@ -54953,9 +55002,9 @@ class Config {
54953
55002
  }],
54954
55003
  syntax: {
54955
55004
  version,
54956
- languageVersion: langVer,
54957
55005
  errorNamespace: "^(Z|Y|LCL\_|TY\_|LIF\_)",
54958
55006
  globalConstants: [],
55007
+ ambigiousVoids: [],
54959
55008
  globalMacros: [],
54960
55009
  },
54961
55010
  rules: rules,
@@ -55006,6 +55055,12 @@ class Config {
55006
55055
  // remove duplicates,
55007
55056
  this.config.syntax.globalConstants = [...new Set(this.config.syntax.globalConstants)];
55008
55057
  }
55058
+ if (this.config.syntax.ambigiousVoids === undefined) {
55059
+ this.config.syntax.ambigiousVoids = [];
55060
+ }
55061
+ else {
55062
+ this.config.syntax.ambigiousVoids = [...new Set(this.config.syntax.ambigiousVoids)];
55063
+ }
55009
55064
  if (this.config.global.skipIncludesWithoutMain === undefined) {
55010
55065
  this.config.global.skipIncludesWithoutMain = false;
55011
55066
  }
@@ -55055,9 +55110,6 @@ class Config {
55055
55110
  return v;
55056
55111
  }
55057
55112
  getLanguageVersion() {
55058
- if (this.config.syntax.languageVersion !== undefined) {
55059
- return this.config.syntax.languageVersion;
55060
- }
55061
55113
  const v = this.config.syntax.version;
55062
55114
  if (v !== undefined && typeof v !== "string") {
55063
55115
  return v.language;
@@ -55082,7 +55134,10 @@ class Config {
55082
55134
  return;
55083
55135
  }
55084
55136
  if (version === version_1.Version.Cloud) {
55085
- this.config.syntax.languageVersion = version_1.LanguageVersion.Cloud;
55137
+ this.config.syntax.version = {
55138
+ release: version_1.Release.Newest.name,
55139
+ language: version_1.LanguageVersion.Cloud,
55140
+ };
55086
55141
  }
55087
55142
  // OpenABAP keeps its own version identity; open-abap-ness is derived from the
55088
55143
  // release in getOpenABAP() rather than a separate stored flag.
@@ -60010,6 +60065,7 @@ function parseDynpros(parsed) {
60010
60065
  fields.push({
60011
60066
  name: f.NAME,
60012
60067
  type: f.TYPE,
60068
+ contType: f.CONT_TYPE,
60013
60069
  length: parseNumber(f.LENGTH),
60014
60070
  vislength: parseNumber(f.VISLENGTH),
60015
60071
  line: parseNumber(f.LINE),
@@ -61897,9 +61953,8 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
61897
61953
  }
61898
61954
  if (found === undefined) {
61899
61955
  // typed virtual element: VIRTUAL <name> : <type>
61900
- const names = e.findAllExpressions(expressions_1.CDSName);
61901
- if (e.findDirectTokenByText("VIRTUAL") !== undefined && names.length > 0) {
61902
- found = names[0];
61956
+ if (e.findDirectTokenByText("VIRTUAL") !== undefined) {
61957
+ found = e.findFirstExpression(expressions_1.CDSName);
61903
61958
  }
61904
61959
  }
61905
61960
  if (found === undefined) {
@@ -69191,7 +69246,7 @@ class Registry {
69191
69246
  }
69192
69247
  static abaplintVersion() {
69193
69248
  // magic, see build script "version.js"
69194
- return "2.119.60";
69249
+ return "2.119.64";
69195
69250
  }
69196
69251
  getDDICReferences() {
69197
69252
  return this.ddicReferences;
@@ -71362,17 +71417,22 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
71362
71417
  test(stru, type, b, e, file) {
71363
71418
  const output = [];
71364
71419
  for (const sub of stru.findAllStructuresRecursive(type)) {
71365
- let begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.NamespaceSimpleName);
71420
+ const beginStatement = sub.findDirectStatement(b);
71421
+ const endStatement = sub.findDirectStatement(e);
71422
+ if (beginStatement === undefined || endStatement === undefined) {
71423
+ continue;
71424
+ }
71425
+ let begin = beginStatement.findFirstExpression(Expressions.NamespaceSimpleName);
71366
71426
  if (begin === undefined) {
71367
- begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.DefinitionName);
71427
+ begin = beginStatement.findFirstExpression(Expressions.DefinitionName);
71368
71428
  }
71369
71429
  if (begin === undefined) {
71370
71430
  continue;
71371
71431
  }
71372
71432
  const first = begin.getFirstToken();
71373
- let end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.NamespaceSimpleName);
71433
+ let end = endStatement.findFirstExpression(Expressions.NamespaceSimpleName);
71374
71434
  if (end === undefined) {
71375
- end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.DefinitionName);
71435
+ end = endStatement.findFirstExpression(Expressions.DefinitionName);
71376
71436
  }
71377
71437
  if (end === undefined) {
71378
71438
  continue;
@@ -75942,6 +76002,7 @@ Make sure to test the downported code, it might not always be completely correct
75942
76002
  const lowConfig = this.lowReg.getConfig().get();
75943
76003
  highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;
75944
76004
  highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;
76005
+ highConfig.syntax.ambigiousVoids = lowConfig.syntax.ambigiousVoids;
75945
76006
  highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;
75946
76007
  this.highReg = new registry_1.Registry();
75947
76008
  for (const o of this.lowReg.getObjects()) {
@@ -78583,7 +78644,7 @@ ${indentation} output = ${uniqueName}.\n`;
78583
78644
  }
78584
78645
  }
78585
78646
  }
78586
- if (fix === undefined && high.findAllExpressions(Expressions.NewObject)) {
78647
+ if (fix === undefined) {
78587
78648
  const found = high.findFirstExpression(Expressions.NewObject);
78588
78649
  if (found === undefined) {
78589
78650
  return undefined;
@@ -78757,12 +78818,13 @@ class DynproChecks {
78757
78818
  const ret = [];
78758
78819
  for (let index = 0; index < dynpro.fields.length; index++) {
78759
78820
  const current = dynpro.fields[index];
78760
- if (current.name === undefined || current.type === "FRAME") {
78821
+ if (current.name === undefined || current.type === "FRAME" || this.hasContainerRelativeCoordinates(current)) {
78761
78822
  continue;
78762
78823
  }
78763
78824
  for (let compare = index + 1; compare < dynpro.fields.length; compare++) {
78764
78825
  const other = dynpro.fields[compare];
78765
- if (other.name === undefined || other.type === "FRAME" || this.overlaps(current, other) === false) {
78826
+ if (other.name === undefined || other.type === "FRAME" || this.hasContainerRelativeCoordinates(other)
78827
+ || this.overlaps(current, other) === false) {
78766
78828
  continue;
78767
78829
  }
78768
78830
  const message = `Screen ${dynpro.number}, ${current.type} ${current.name} and ${other.type} ${other.name} are overlapping`;
@@ -78771,6 +78833,9 @@ class DynproChecks {
78771
78833
  }
78772
78834
  return ret;
78773
78835
  }
78836
+ hasContainerRelativeCoordinates(field) {
78837
+ return field.contType === "TABLE_CTRL" || field.contType === "LOOP" || field.contType === "STRIP_CTRL";
78838
+ }
78774
78839
  overlaps(first, second) {
78775
78840
  if (first.line === 0 || second.line === 0 || first.column === 0 || second.column === 0) {
78776
78841
  return false;
@@ -86220,7 +86285,6 @@ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/ex
86220
86285
  const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
86221
86286
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
86222
86287
  const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
86223
- const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
86224
86288
  const expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
86225
86289
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
86226
86290
  class NamesNoDashConf extends _basic_rule_config_1.BasicRuleConfig {
@@ -86260,32 +86324,26 @@ class NamesNoDash extends _abap_rule_1.ABAPRule {
86260
86324
  if (obj.getType() !== "CLAS" && obj.getType() !== "INTF") {
86261
86325
  for (const form of struc.findAllStatements(Statements.Form)) {
86262
86326
  const expr = form.findFirstExpression(expressions_1.FormName);
86263
- for (const token of expr.getTokens()) {
86264
- if (token instanceof tokens_1.Dash || token instanceof tokens_1.DashW) {
86265
- const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
86266
- issues.push(issue);
86267
- break;
86268
- }
86327
+ const token = expr === null || expr === void 0 ? void 0 : expr.findDirectTokenByText("-");
86328
+ if (token) {
86329
+ const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
86330
+ issues.push(issue);
86269
86331
  }
86270
86332
  }
86271
86333
  for (const form of struc.findAllStatements(Statements.Parameter)) {
86272
86334
  const expr = form.findFirstExpression(Expressions.FieldSub);
86273
- for (const token of expr.getTokens()) {
86274
- if (token instanceof tokens_1.Dash || token instanceof tokens_1.DashW) {
86275
- const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
86276
- issues.push(issue);
86277
- break;
86278
- }
86335
+ const token = expr === null || expr === void 0 ? void 0 : expr.findDirectTokenByText("-");
86336
+ if (token) {
86337
+ const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
86338
+ issues.push(issue);
86279
86339
  }
86280
86340
  }
86281
86341
  for (const form of struc.findAllStatements(Statements.SelectOption)) {
86282
86342
  const expr = form.findFirstExpression(Expressions.FieldSub);
86283
- for (const token of expr.getTokens()) {
86284
- if (token instanceof tokens_1.Dash || token instanceof tokens_1.DashW) {
86285
- const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
86286
- issues.push(issue);
86287
- break;
86288
- }
86343
+ const token = expr === null || expr === void 0 ? void 0 : expr.findDirectTokenByText("-");
86344
+ if (token) {
86345
+ const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);
86346
+ issues.push(issue);
86289
86347
  }
86290
86348
  }
86291
86349
  }
@@ -88387,11 +88445,11 @@ ENDIF.`,
88387
88445
  }
88388
88446
  }
88389
88447
  else {
88390
- const classNameExpression = staNode.findAllExpressions(Expressions.ClassName);
88391
- const methodNameExpression = staNode.findAllExpressions(Expressions.MethodName);
88392
- if (classNameExpression.length !== 0 && methodNameExpression.length !== 0) {
88393
- const className = classNameExpression[0].concatTokens();
88394
- const methodName = methodNameExpression[0].concatTokens();
88448
+ const classNameExpression = staNode.findFirstExpression(Expressions.ClassName);
88449
+ const methodNameExpression = staNode.findFirstExpression(Expressions.MethodName);
88450
+ if (classNameExpression && methodNameExpression) {
88451
+ const className = classNameExpression.concatTokens();
88452
+ const methodName = methodNameExpression.concatTokens();
88395
88453
  if (className === "cl_abap_regex") {
88396
88454
  if (methodName === "create_posix") {
88397
88455
  const issue = issue_1.Issue.atStatement(file, staNode, "create_posix obsolete, use create_pcre", this.getMetadata().key, this.conf.severity);
@@ -92553,12 +92611,12 @@ class ShortCase extends _abap_rule_1.ABAPRule {
92553
92611
  return [];
92554
92612
  }
92555
92613
  for (const c of struc.findAllStructures(Structures.Case)) {
92556
- const clist = c.findDirectStatements(Statements.Case);
92557
- if (clist.length > 0 && this.conf.allow && this.conf.allow.find((e) => { return e === clist[0].getTokens()[1].getStr(); })) {
92614
+ const caseStatement = c.findDirectStatement(Statements.Case);
92615
+ if (caseStatement && this.conf.allow && this.conf.allow.find((e) => { return e === caseStatement.getTokens()[1].getStr(); })) {
92558
92616
  continue;
92559
92617
  }
92560
92618
  if (c.findDirectStructures(Structures.When).length <= this.conf.length) {
92561
- if (c.findAllExpressions(Expressions.Or).length > 0) {
92619
+ if (c.findFirstExpression(Expressions.Or)) {
92562
92620
  continue;
92563
92621
  }
92564
92622
  const issue = issue_1.Issue.atToken(file, c.getFirstToken(), this.getMessage(), this.getMetadata().key, this.conf.severity);
@@ -94382,9 +94440,9 @@ class TryWithoutCatch extends _abap_rule_1.ABAPRule {
94382
94440
  }
94383
94441
  const tries = stru.findAllStructures(structures_1.Try);
94384
94442
  for (const t of tries) {
94385
- const clean = t.findDirectStructures(structures_1.Cleanup);
94386
- const c = t.findDirectStructures(structures_1.Catch);
94387
- if (c.length === 0 && clean.length === 0) {
94443
+ const clean = t.findDirectStructure(structures_1.Cleanup);
94444
+ const c = t.findDirectStructure(structures_1.Catch);
94445
+ if (c === undefined && clean === undefined) {
94388
94446
  const issue = issue_1.Issue.atToken(file, t.getFirstToken(), this.getMessage(), this.getMetadata().key, this.conf.severity);
94389
94447
  issues.push(issue);
94390
94448
  }
@@ -95293,6 +95351,7 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
95293
95351
  const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
95294
95352
  const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
95295
95353
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
95354
+ const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
95296
95355
  class UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {
95297
95356
  constructor() {
95298
95357
  super(...arguments);
@@ -95361,6 +95420,17 @@ DATA: BEGIN OF blah ##NEEDED,
95361
95420
  for (let i = 0; i < statements.length; i++) {
95362
95421
  const statement = statements[i];
95363
95422
  const nextStatement = statements[i + 1];
95423
+ if (statement.get() instanceof _statement_1.Empty
95424
+ && statement.getChildren().length === 1) {
95425
+ const tokens = statement.getTokens();
95426
+ if (tokens.length === 1
95427
+ && tokens[0] instanceof tokens_1.Pragma) {
95428
+ const message = "Pragma without a statement can be removed";
95429
+ const fix = edit_helper_1.EditHelper.deleteToken(file, tokens[0]);
95430
+ issues.push(issue_1.Issue.atToken(file, tokens[0], message, this.getMetadata().key, this.conf.severity, fix));
95431
+ continue;
95432
+ }
95433
+ }
95364
95434
  if (statement.get() instanceof Statements.EndTry) {
95365
95435
  noHandler = false;
95366
95436
  }
@@ -98074,9 +98144,11 @@ const include_graph_1 = __webpack_require__(/*! ./utils/include_graph */ "./node
98074
98144
  class SkipLogic {
98075
98145
  constructor(reg) {
98076
98146
  this.reg = reg;
98147
+ this.includeGraph = undefined;
98077
98148
  this.tobj = undefined;
98078
98149
  }
98079
98150
  skip(obj) {
98151
+ var _a;
98080
98152
  const global = this.reg.getConfig().getGlobal();
98081
98153
  if (global.skipGeneratedGatewayClasses === true
98082
98154
  && obj instanceof objects_1.Class
@@ -98086,9 +98158,9 @@ class SkipLogic {
98086
98158
  else if (global.skipIncludesWithoutMain === true
98087
98159
  && obj instanceof objects_1.Program
98088
98160
  && obj.isInclude() === true) {
98089
- const ig = new include_graph_1.IncludeGraph(this.reg);
98161
+ (_a = this.includeGraph) !== null && _a !== void 0 ? _a : (this.includeGraph = new include_graph_1.IncludeGraph(this.reg));
98090
98162
  const file = obj.getMainABAPFile();
98091
- if (file && ig.listMainForInclude(file.getFilename()).length === 0) {
98163
+ if (file && this.includeGraph.listMainForInclude(file.getFilename()).length === 0) {
98092
98164
  return true;
98093
98165
  }
98094
98166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.13.38",
3
+ "version": "2.13.39",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  "author": "abaplint",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@abaplint/core": "^2.119.60",
31
- "@abaplint/transpiler": "^2.13.38",
30
+ "@abaplint/core": "^2.119.64",
31
+ "@abaplint/transpiler": "^2.13.39",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.12.2",
34
34
  "@types/progress": "^2.0.7",