@abaplint/cli 2.120.33 → 2.120.35

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 +62 -24
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -26709,6 +26709,11 @@ class ObjectOriented {
26709
26709
  if (found) {
26710
26710
  return found;
26711
26711
  }
26712
+ if (name.includes("~")) {
26713
+ // event of an implemented interface, ie. "if_name~event_name"
26714
+ const [interfaceName, eventName] = name.split("~");
26715
+ return this.searchEvent(this.scope.findInterfaceDefinition(interfaceName), eventName);
26716
+ }
26712
26717
  for (const a of def.getAliases() || []) {
26713
26718
  if (a.getName().toUpperCase() === name.toUpperCase()) {
26714
26719
  const comp = a.getComponent();
@@ -27777,6 +27782,11 @@ class TypeUtils {
27777
27782
  }
27778
27783
  return false;
27779
27784
  }
27785
+ else if (target instanceof basic_1.TableType
27786
+ || target instanceof basic_1.DataReference
27787
+ || target instanceof basic_1.ObjectReferenceType) {
27788
+ return false;
27789
+ }
27780
27790
  return true;
27781
27791
  }
27782
27792
  else if (source instanceof basic_1.StructureType) {
@@ -27801,7 +27811,8 @@ class TypeUtils {
27801
27811
  }
27802
27812
  else if (target instanceof basic_1.VoidType
27803
27813
  || target instanceof basic_1.AnyType
27804
- || target instanceof basic_1.DataType) {
27814
+ || target instanceof basic_1.DataType
27815
+ || target instanceof basic_1.UnknownType) {
27805
27816
  return true;
27806
27817
  }
27807
27818
  return false;
@@ -51688,6 +51699,7 @@ const constants_1 = __webpack_require__(/*! ../5_syntax/structures/constants */
51688
51699
  const type_definitions_1 = __webpack_require__(/*! ./type_definitions */ "../core/build/src/abap/types/type_definitions.js");
51689
51700
  const types_1 = __webpack_require__(/*! ../5_syntax/structures/types */ "../core/build/src/abap/5_syntax/structures/types.js");
51690
51701
  const type_1 = __webpack_require__(/*! ../5_syntax/statements/type */ "../core/build/src/abap/5_syntax/statements/type.js");
51702
+ const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
51691
51703
  const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
51692
51704
  const alias_1 = __webpack_require__(/*! ./alias */ "../core/build/src/abap/types/alias.js");
51693
51705
  class Attributes {
@@ -51909,6 +51921,13 @@ class Attributes {
51909
51921
  if (foundAttribute) {
51910
51922
  input.scope.addNamedIdentifier(aliasName.getStr(), foundAttribute);
51911
51923
  }
51924
+ const component = compName.split("~")[1];
51925
+ if (foundType === undefined
51926
+ && foundAttribute === undefined
51927
+ && this.existsInInterface(idef, component, input, []) === false) {
51928
+ const message = "Component " + component + " not found in interface " + idef.getName();
51929
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, compToken, message));
51930
+ }
51912
51931
  }
51913
51932
  else if (this.declaredInterfaces.includes(name.toUpperCase()) || input.scope.getDDIC().inErrorNamespace(name) === false) {
51914
51933
  input.scope.addReference(compToken, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename);
@@ -51918,6 +51937,33 @@ class Attributes {
51918
51937
  }
51919
51938
  }
51920
51939
  }
51940
+ /** does the component exist in the interface, or in one of its aliases or included interfaces? */
51941
+ existsInInterface(idef, component, input, visited) {
51942
+ const upperName = idef.getName().toUpperCase();
51943
+ if (visited.includes(upperName)) {
51944
+ return false;
51945
+ }
51946
+ visited.push(upperName);
51947
+ const upper = component.toUpperCase();
51948
+ if (idef.getTypeDefinitions().getByName(component) !== undefined
51949
+ || idef.getAttributes().findByName(component) !== undefined
51950
+ || idef.getMethodDefinitions().getByName(component) !== undefined
51951
+ || idef.getEvents().some(e => e.getName().toUpperCase() === upper)
51952
+ || idef.getAliases().some(a => a.getName().toUpperCase() === upper)) {
51953
+ return true;
51954
+ }
51955
+ for (const i of idef.getImplementing()) {
51956
+ const sub = input.scope.findInterfaceDefinition(i.name);
51957
+ if (sub === undefined) {
51958
+ // voided or not found, assume the component exists
51959
+ return true;
51960
+ }
51961
+ else if (this.existsInInterface(sub, component, input, visited)) {
51962
+ return true;
51963
+ }
51964
+ }
51965
+ return false;
51966
+ }
51921
51967
  parseAttribute(node, visibility, input) {
51922
51968
  let found = undefined;
51923
51969
  const s = node.get();
@@ -70060,7 +70106,7 @@ class Registry {
70060
70106
  }
70061
70107
  static abaplintVersion() {
70062
70108
  // magic, see build script "version.js"
70063
- return "2.120.33";
70109
+ return "2.120.35";
70064
70110
  }
70065
70111
  getDDICReferences() {
70066
70112
  return this.ddicReferences;
@@ -73264,7 +73310,8 @@ class CDSFieldOrder {
73264
73310
  }
73265
73311
  getAssociationNames(tree) {
73266
73312
  const names = new Set();
73267
- for (const assoc of tree.findAllExpressions(expressions_1.CDSAssociation)) {
73313
+ const found = [...tree.findAllExpressions(expressions_1.CDSAssociation), ...tree.findAllExpressions(expressions_1.CDSComposition)];
73314
+ for (const assoc of found) {
73268
73315
  const relation = assoc.findDirectExpression(expressions_1.CDSRelation);
73269
73316
  if (relation === undefined) {
73270
73317
  continue;
@@ -73382,7 +73429,6 @@ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_i
73382
73429
  const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
73383
73430
  const objects_1 = __webpack_require__(/*! ../objects */ "../core/build/src/objects/index.js");
73384
73431
  const expressions_1 = __webpack_require__(/*! ../cds/expressions */ "../core/build/src/cds/expressions/index.js");
73385
- const cds_name_1 = __webpack_require__(/*! ../cds/expressions/cds_name */ "../core/build/src/cds/expressions/cds_name.js");
73386
73432
  class CDSNamingConf extends _basic_rule_config_1.BasicRuleConfig {
73387
73433
  constructor() {
73388
73434
  super(...arguments);
@@ -73454,7 +73500,7 @@ https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee6ff9b281d8448f96b4fe6c89f2bdc8
73454
73500
  if (file === undefined) {
73455
73501
  return [];
73456
73502
  }
73457
- const name = this.getCDSName(tree);
73503
+ const name = o.getDefinitionName();
73458
73504
  if (name === undefined) {
73459
73505
  return [];
73460
73506
  }
@@ -73471,13 +73517,6 @@ https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee6ff9b281d8448f96b4fe6c89f2bdc8
73471
73517
  }
73472
73518
  return [];
73473
73519
  }
73474
- getCDSName(tree) {
73475
- const nameNodes = tree.findDirectExpressions(cds_name_1.CDSName);
73476
- if (nameNodes.length > 0) {
73477
- return nameNodes[0].getFirstToken().getStr();
73478
- }
73479
- return undefined;
73480
- }
73481
73520
  getAllowedPrefixes(tree) {
73482
73521
  const root = tree.get();
73483
73522
  if (root instanceof expressions_1.CDSExtendView) {
@@ -88496,17 +88535,19 @@ class NoDynamicStuff extends _abap_rule_1.ABAPRule {
88496
88535
  extendedInformation: `Dynamic constructs cannot be checked statically, they are not found by
88497
88536
  where-used lists and refactorings, and they can introduce injection vulnerabilities.
88498
88537
 
88499
- Dynamic tokens containing a literal, eg. CALL METHOD ('CL_FOO')=>('BAR'), are not reported,
88500
- as these are equivalent to the static variant.
88538
+ Dynamic tokens are also reported when containing a literal, eg. CALL METHOD go_calendar->('RESET_DAY_INFO'),
88539
+ the syntax check does not resolve these either, so they behave like any other dynamic token.
88501
88540
 
88502
88541
  Dynamic SQL is reported by rule dangerous_statement.`,
88503
88542
  tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
88504
88543
  badExample: `CALL METHOD (lv_class)=>(lv_method).
88544
+ CALL METHOD go_calendar->('RESET_DAY_INFO').
88505
88545
  CALL FUNCTION lv_function_module.
88506
88546
  CREATE OBJECT ref TYPE (lv_class).
88507
88547
  ASSIGN (lv_name) TO <fs>.
88508
88548
  SORT tab BY (lv_field).`,
88509
88549
  goodExample: `cl_class=>method( ).
88550
+ go_calendar->reset_day_info( ).
88510
88551
  CALL FUNCTION 'ZFOO'.
88511
88552
  CREATE OBJECT ref TYPE cl_class.
88512
88553
  ASSIGN foo TO <fs>.
@@ -88618,10 +88659,8 @@ SORT tab BY field.`,
88618
88659
  for (const source of node.findAllExpressions(Expressions.MethodSource)) {
88619
88660
  // Dynamic is always a direct child of MethodSource, dynamics further down
88620
88661
  // are parameters of the method call and not part of the method name
88621
- for (const dynamic of source.findDirectExpressions(Expressions.Dynamic)) {
88622
- if (this.isLiteral(dynamic) === false) {
88623
- return true;
88624
- }
88662
+ if (source.findDirectExpression(Expressions.Dynamic) !== undefined) {
88663
+ return true;
88625
88664
  }
88626
88665
  }
88627
88666
  return false;
@@ -88632,12 +88671,7 @@ SORT tab BY field.`,
88632
88671
  return component !== undefined && this.isLiteral(component) === false;
88633
88672
  }
88634
88673
  hasDynamic(node) {
88635
- for (const dynamic of node.findAllExpressions(Expressions.Dynamic)) {
88636
- if (this.isLiteral(dynamic) === false) {
88637
- return true;
88638
- }
88639
- }
88640
- return false;
88674
+ return node.findFirstExpression(Expressions.Dynamic) !== undefined;
88641
88675
  }
88642
88676
  notLiteral(node) {
88643
88677
  return node !== undefined && this.isLiteral(node) === false;
@@ -100634,6 +100668,10 @@ exports.DECLARATION_STUFF = [
100634
100668
  Statements.DataBegin,
100635
100669
  Statements.Constant,
100636
100670
  Statements.ConstantBegin,
100671
+ Statements.Static,
100672
+ Statements.StaticBegin,
100673
+ Statements.FieldSymbol,
100674
+ Statements.Ranges,
100637
100675
  Statements.Tables,
100638
100676
  Statements.Include, // this is not super correct, but anyhow
100639
100677
  Statements.Parameter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.33",
3
+ "version": "2.120.35",
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.120.33",
42
+ "@abaplint/core": "^2.120.35",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",