@abaplint/core 2.119.2 → 2.119.3

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.
@@ -5942,6 +5942,7 @@ declare abstract class ScopeData {
5942
5942
  export declare enum ScopeType {
5943
5943
  BuiltIn = "_builtin",
5944
5944
  Dummy = "_dummy",
5945
+ SelectionEvent = "selection_event",
5945
5946
  Global = "_global",
5946
5947
  Program = "_program",
5947
5948
  TypePool = "_type_pool",
@@ -7071,6 +7072,10 @@ export declare class SyntaxLogic {
7071
7072
  */
7072
7073
  private updateScopeStructure;
7073
7074
  private updateScopeStatement;
7075
+ private updateSelectionEventScope;
7076
+ private opensSelectionEventScope;
7077
+ private isSelectionEventBoundary;
7078
+ private isSelectionEventBoundaryStructure;
7074
7079
  }
7075
7080
 
7076
7081
  declare class SystemCall implements IStatement {
@@ -5,6 +5,8 @@ var ScopeType;
5
5
  (function (ScopeType) {
6
6
  ScopeType["BuiltIn"] = "_builtin";
7
7
  ScopeType["Dummy"] = "_dummy";
8
+ // definitions inside this one are local
9
+ ScopeType["SelectionEvent"] = "selection_event";
8
10
  ScopeType["Global"] = "_global";
9
11
  ScopeType["Program"] = "_program";
10
12
  ScopeType["TypePool"] = "_type_pool";
@@ -152,6 +152,7 @@ const commit_entities_1 = require("./statements/commit_entities");
152
152
  const _syntax_input_1 = require("./_syntax_input");
153
153
  const assert_error_1 = require("./assert_error");
154
154
  const field_group_1 = require("./statements/field_group");
155
+ const stuff_1 = require("../../stuff");
155
156
  // -----------------------------------
156
157
  const map = {};
157
158
  function addToMap(handler) {
@@ -405,6 +406,9 @@ class SyntaxLogic {
405
406
  updateScopeStructure(node) {
406
407
  const filename = this.currentFile.getFilename();
407
408
  const stru = node.get();
409
+ if (this.scope.getType() === _scope_type_1.ScopeType.SelectionEvent && this.isSelectionEventBoundaryStructure(stru)) {
410
+ this.scope.pop(node.getFirstToken().getStart());
411
+ }
408
412
  const input = {
409
413
  scope: this.scope,
410
414
  filename,
@@ -444,6 +448,7 @@ class SyntaxLogic {
444
448
  updateScopeStatement(node) {
445
449
  const filename = this.currentFile.getFilename();
446
450
  const s = node.get();
451
+ this.updateSelectionEventScope(node);
447
452
  const input = {
448
453
  scope: this.scope,
449
454
  filename,
@@ -489,6 +494,27 @@ class SyntaxLogic {
489
494
  }
490
495
  }
491
496
  }
497
+ updateSelectionEventScope(node) {
498
+ const statement = node.get();
499
+ if (this.scope.getType() === _scope_type_1.ScopeType.SelectionEvent && this.isSelectionEventBoundary(statement)) {
500
+ this.scope.pop(node.getFirstToken().getStart());
501
+ }
502
+ if (this.opensSelectionEventScope(statement)) {
503
+ this.scope.push(_scope_type_1.ScopeType.SelectionEvent, statement.constructor.name, node.getFirstToken().getStart(), this.currentFile.getFilename());
504
+ }
505
+ }
506
+ opensSelectionEventScope(statement) {
507
+ return statement instanceof Statements.AtSelectionScreen;
508
+ }
509
+ isSelectionEventBoundary(statement) {
510
+ return stuff_1.SELECTION_EVENTS.some(event => statement instanceof event)
511
+ || statement instanceof Statements.Form
512
+ || statement instanceof Statements.FunctionModule;
513
+ }
514
+ isSelectionEventBoundaryStructure(structure) {
515
+ return structure instanceof Structures.ClassDefinition
516
+ || structure instanceof Structures.Interface;
517
+ }
492
518
  }
493
519
  exports.SyntaxLogic = SyntaxLogic;
494
520
  //# sourceMappingURL=syntax.js.map
@@ -173,7 +173,7 @@ class ClassDefinition extends _identifier_1.Identifier {
173
173
  input.scope.addReference(token, undefined, _reference_1.ReferenceType.ObjectOrientedVoidReference, input.filename);
174
174
  }
175
175
  else {
176
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, name.toUpperCase() + " does not exist"));
176
+ input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, "Friend class " + name.toUpperCase() + " does not exist"));
177
177
  }
178
178
  result.push(name);
179
179
  }
@@ -74,7 +74,7 @@ class Registry {
74
74
  }
75
75
  static abaplintVersion() {
76
76
  // magic, see build script "version.sh"
77
- return "2.119.2";
77
+ return "2.119.3";
78
78
  }
79
79
  getDDICReferences() {
80
80
  return this.ddicReferences;
@@ -6,6 +6,7 @@ const _basic_rule_config_1 = require("./_basic_rule_config");
6
6
  const _abap_rule_1 = require("./_abap_rule");
7
7
  const Expressions = require("../abap/2_statements/expressions");
8
8
  const _irule_1 = require("./_irule");
9
+ const edit_helper_1 = require("../edit_helper");
9
10
  class KeepSingleParameterCallsOnOneLineConf extends _basic_rule_config_1.BasicRuleConfig {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -25,7 +26,7 @@ class KeepSingleParameterCallsOnOneLine extends _abap_rule_1.ABAPRule {
25
26
  title: "Keep single parameters on one line",
26
27
  shortDescription: `Keep single parameter calls on one line`,
27
28
  extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-single-parameter-calls-on-one-line`,
28
- tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
29
+ tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
29
30
  badExample: `call_method(\n 2 ).`,
30
31
  goodExample: `call_method( 2 ).`,
31
32
  };
@@ -101,7 +102,8 @@ class KeepSingleParameterCallsOnOneLine extends _abap_rule_1.ABAPRule {
101
102
  }
102
103
  }
103
104
  const message = "Keep single parameter on one line";
104
- return [issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity)];
105
+ const fix = edit_helper_1.EditHelper.replaceRange(file, c.getFirstToken().getStart(), c.getLastToken().getEnd(), c.concatTokens());
106
+ return [issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix)];
105
107
  }
106
108
  return [];
107
109
  }
@@ -5,6 +5,7 @@ const issue_1 = require("../issue");
5
5
  const _basic_rule_config_1 = require("./_basic_rule_config");
6
6
  const Objects = require("../objects");
7
7
  const _abap_object_1 = require("../objects/_abap_object");
8
+ const _irule_1 = require("./_irule");
8
9
  const Statements = require("../abap/2_statements/statements");
9
10
  const Expressions = require("../abap/2_statements/expressions");
10
11
  const position_1 = require("../position");
@@ -22,6 +23,7 @@ class MainFileContents {
22
23
  key: "main_file_contents",
23
24
  title: "Main file contents",
24
25
  shortDescription: `Checks related to report declarations.`,
26
+ tags: [_irule_1.RuleTag.Syntax],
25
27
  extendedInformation: `Does not run if the target version is Cloud
26
28
 
27
29
  * PROGs must begin with "REPORT <name>." or "PROGRAM <name>.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.119.2",
3
+ "version": "2.119.3",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",