@abaplint/core 2.101.7 → 2.101.9

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.
@@ -423,6 +423,7 @@ declare namespace BasicTypes {
423
423
  GenericObjectReferenceType,
424
424
  HexType,
425
425
  IntegerType,
426
+ Integer8Type,
426
427
  NumericGenericType,
427
428
  NumericType,
428
429
  ObjectReferenceType,
@@ -2131,6 +2132,7 @@ declare namespace Expressions {
2131
2132
  SQLAggregation,
2132
2133
  SQLAliasField,
2133
2134
  SQLArithmetics,
2135
+ SQLArithmeticOperator,
2134
2136
  SQLAsName,
2135
2137
  SQLCase,
2136
2138
  SQLCDSParameters,
@@ -3331,6 +3333,14 @@ declare class Integer extends Expression {
3331
3333
  getRunnable(): IStatementRunnable;
3332
3334
  }
3333
3335
 
3336
+ declare class Integer8Type extends AbstractType {
3337
+ toText(): string;
3338
+ isGeneric(): boolean;
3339
+ toABAP(): string;
3340
+ containsVoid(): boolean;
3341
+ toCDS(): string;
3342
+ }
3343
+
3334
3344
  declare class IntegerType extends AbstractType {
3335
3345
  toText(): string;
3336
3346
  isGeneric(): boolean;
@@ -3627,6 +3637,7 @@ export declare interface ISpaghettiScopeNode {
3627
3637
  end: Position;
3628
3638
  };
3629
3639
  findClassDefinition(name: string): IClassDefinition | undefined;
3640
+ listClassDefinitions(): IClassDefinition[];
3630
3641
  findFormDefinition(name: string): IFormDefinition | undefined;
3631
3642
  listFormDefinitions(): IFormDefinition[];
3632
3643
  findInterfaceDefinition(name: string): IInterfaceDefinition | undefined;
@@ -5284,6 +5295,7 @@ export declare class SpaghettiScopeNode extends ScopeData implements ISpaghettiS
5284
5295
  setEnd(end: Position): void;
5285
5296
  findDeferred(name: string): Identifier | undefined;
5286
5297
  findClassDefinition(name: string): IClassDefinition | undefined;
5298
+ listClassDefinitions(): IClassDefinition[];
5287
5299
  findFormDefinition(name: string): IFormDefinition | undefined;
5288
5300
  listFormDefinitions(): IFormDefinition[];
5289
5301
  findInterfaceDefinition(name: string): IInterfaceDefinition | undefined;
@@ -5308,6 +5320,10 @@ declare class SQLAliasField extends Expression {
5308
5320
  getRunnable(): IStatementRunnable;
5309
5321
  }
5310
5322
 
5323
+ declare class SQLArithmeticOperator extends Expression {
5324
+ getRunnable(): IStatementRunnable;
5325
+ }
5326
+
5311
5327
  declare class SQLArithmetics extends Expression {
5312
5328
  getRunnable(): IStatementRunnable;
5313
5329
  }
@@ -169,6 +169,7 @@ __exportStar(require("./source"), exports);
169
169
  __exportStar(require("./sql_aggregation"), exports);
170
170
  __exportStar(require("./sql_alias_field"), exports);
171
171
  __exportStar(require("./sql_arithmetics"), exports);
172
+ __exportStar(require("./sql_arithmetic_operator"), exports);
172
173
  __exportStar(require("./sql_as_name"), exports);
173
174
  __exportStar(require("./sql_case"), exports);
174
175
  __exportStar(require("./sql_cds_parameters"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLArithmeticOperator = void 0;
4
+ const combi_1 = require("../combi");
5
+ const tokens_1 = require("../../1_lexer/tokens");
6
+ class SQLArithmeticOperator extends combi_1.Expression {
7
+ getRunnable() {
8
+ const operator = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WPlusW), (0, combi_1.tok)(tokens_1.WDashW), "*", "/");
9
+ return operator;
10
+ }
11
+ }
12
+ exports.SQLArithmeticOperator = SQLArithmeticOperator;
13
+ //# sourceMappingURL=sql_arithmetic_operator.js.map
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SQLArithmetics = void 0;
4
4
  const combi_1 = require("../combi");
5
5
  const _1 = require(".");
6
- const tokens_1 = require("../../1_lexer/tokens");
6
+ const sql_arithmetic_operator_1 = require("./sql_arithmetic_operator");
7
7
  class SQLArithmetics extends combi_1.Expression {
8
8
  getRunnable() {
9
- const operator = (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WPlusW), (0, combi_1.tok)(tokens_1.WDashW), "*", "/");
10
9
  const field = (0, combi_1.alt)(_1.SQLFieldName, _1.SQLFunction);
11
- return (0, combi_1.seq)(field, (0, combi_1.starPrio)((0, combi_1.seq)(operator, field)));
10
+ return (0, combi_1.seq)(field, (0, combi_1.starPrio)((0, combi_1.seq)(sql_arithmetic_operator_1.SQLArithmeticOperator, field)));
12
11
  }
13
12
  }
14
13
  exports.SQLArithmetics = SQLArithmetics;
@@ -2,11 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SQLFieldAndValue = void 0;
4
4
  const combi_1 = require("../combi");
5
+ const integer_1 = require("./integer");
6
+ const sql_arithmetic_operator_1 = require("./sql_arithmetic_operator");
5
7
  const sql_field_name_1 = require("./sql_field_name");
6
8
  const sql_source_1 = require("./sql_source");
7
9
  class SQLFieldAndValue extends combi_1.Expression {
8
10
  getRunnable() {
9
- const param = (0, combi_1.seq)(sql_field_name_1.SQLFieldName, "=", sql_source_1.SQLSource);
11
+ const opt1 = (0, combi_1.seq)((0, combi_1.altPrio)(integer_1.Integer, sql_field_name_1.SQLFieldName), sql_arithmetic_operator_1.SQLArithmeticOperator, sql_source_1.SQLSource);
12
+ const param = (0, combi_1.seq)(sql_field_name_1.SQLFieldName, "=", (0, combi_1.altPrio)(opt1, sql_source_1.SQLSource));
10
13
  return param;
11
14
  }
12
15
  }
@@ -266,6 +266,11 @@ class TypeUtils {
266
266
  }
267
267
  return true;
268
268
  }
269
+ else if (source instanceof basic_1.Integer8Type) {
270
+ if (target instanceof basic_1.IntegerType || target instanceof basic_1.StringType) {
271
+ return false;
272
+ }
273
+ }
269
274
  return this.isAssignable(source, target);
270
275
  }
271
276
  isAssignable(source, target) {
@@ -77,6 +77,15 @@ class SpaghettiScopeNode extends ScopeData {
77
77
  }
78
78
  return undefined;
79
79
  }
80
+ listClassDefinitions() {
81
+ let search = this;
82
+ const ret = [];
83
+ while (search !== undefined) {
84
+ ret.push(...Object.values(search.getData().cdefs));
85
+ search = search.getParent();
86
+ }
87
+ return ret;
88
+ }
80
89
  findFormDefinition(name) {
81
90
  let search = this;
82
91
  const upper = name.toUpperCase();
@@ -29,6 +29,7 @@ __exportStar(require("./floating_point_type"), exports);
29
29
  __exportStar(require("./generic_object_reference_type"), exports);
30
30
  __exportStar(require("./hex_type"), exports);
31
31
  __exportStar(require("./integer_type"), exports);
32
+ __exportStar(require("./integer8_type"), exports);
32
33
  __exportStar(require("./numeric_generic_type"), exports);
33
34
  __exportStar(require("./numeric_type"), exports);
34
35
  __exportStar(require("./object_reference_type"), exports);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Integer8Type = void 0;
4
+ const _abstract_type_1 = require("./_abstract_type");
5
+ class Integer8Type extends _abstract_type_1.AbstractType {
6
+ toText() {
7
+ return "```int8```";
8
+ }
9
+ isGeneric() {
10
+ return false;
11
+ }
12
+ toABAP() {
13
+ return "int8";
14
+ }
15
+ containsVoid() {
16
+ return false;
17
+ }
18
+ toCDS() {
19
+ return "abap.int8";
20
+ }
21
+ }
22
+ exports.Integer8Type = Integer8Type;
23
+ //# sourceMappingURL=integer8_type.js.map
package/build/src/ddic.js CHANGED
@@ -80,8 +80,9 @@ class DDIC {
80
80
  case "CSEQUENCE":
81
81
  return new Types.CSequenceType({ qualifiedName: qualifiedName });
82
82
  case "I":
83
- case "INT8": // todo, take version into account
84
83
  return new Types.IntegerType({ qualifiedName: qualifiedName || name });
84
+ case "INT8": // todo, take version into account
85
+ return new Types.Integer8Type({ qualifiedName: qualifiedName || name });
85
86
  case "F":
86
87
  return new Types.FloatType({ qualifiedName: qualifiedName || name });
87
88
  case "P":
@@ -13,6 +13,7 @@ const _scope_type_1 = require("../abap/5_syntax/_scope_type");
13
13
  const types_1 = require("../abap/types");
14
14
  class LSPLookup {
15
15
  static lookup(cursor, reg, obj) {
16
+ var _a, _b;
16
17
  const inc = this.findInclude(cursor, reg);
17
18
  if (inc) {
18
19
  const found = this.ABAPFileResult(inc);
@@ -82,6 +83,22 @@ class LSPLookup {
82
83
  }
83
84
  return { hover: hoverValue, definition: location, implementation: location, definitionId: variable, scope: bottomScope };
84
85
  }
86
+ for (const c of bottomScope.listClassDefinitions()) {
87
+ for (const m of ((_a = c.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
88
+ for (const p of ((_b = m.getParameters()) === null || _b === void 0 ? void 0 : _b.getAll()) || []) {
89
+ if (p.getStart().equals(cursor.token.getStart())) {
90
+ const found = _lsp_utils_1.LSPUtils.identiferToLocation(p);
91
+ return {
92
+ hover: "Method Parameter, " + cursor.token.getStr(),
93
+ definition: found,
94
+ definitionId: p,
95
+ implementation: undefined,
96
+ scope: bottomScope,
97
+ };
98
+ }
99
+ }
100
+ }
101
+ }
85
102
  const refs = this.searchReferences(bottomScope, cursor.token);
86
103
  if (refs.length > 0) {
87
104
  for (const ref of refs) {
@@ -9,11 +9,13 @@ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
9
9
  const types_1 = require("../abap/types");
10
10
  const references_1 = require("./references");
11
11
  const renamer_1 = require("../objects/rename/renamer");
12
+ const definition_1 = require("./definition");
12
13
  var RenameType;
13
14
  (function (RenameType) {
14
15
  RenameType[RenameType["GlobalClass"] = 1] = "GlobalClass";
15
16
  RenameType[RenameType["Variable"] = 2] = "Variable";
16
17
  RenameType[RenameType["GlobalInterface"] = 3] = "GlobalInterface";
18
+ RenameType[RenameType["Method"] = 4] = "Method";
17
19
  })(RenameType = exports.RenameType || (exports.RenameType = {}));
18
20
  class Rename {
19
21
  constructor(reg) {
@@ -43,6 +45,9 @@ class Rename {
43
45
  else if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof types_1.InterfaceDefinition) {
44
46
  return { range, placeholder: cursor.token.getStr(), type: RenameType.GlobalInterface, file };
45
47
  }
48
+ else if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof types_1.MethodDefinition) {
49
+ return { range, placeholder: cursor.token.getStr(), type: RenameType.Method, file };
50
+ }
46
51
  return undefined;
47
52
  }
48
53
  rename(params) {
@@ -57,6 +62,8 @@ class Rename {
57
62
  return new renamer_1.Renamer(this.reg).buildEdits("INTF", prepare.placeholder, params.newName);
58
63
  case RenameType.Variable:
59
64
  return this.renameVariable(params);
65
+ case RenameType.Method:
66
+ return this.renameMethod(params);
60
67
  default:
61
68
  return undefined;
62
69
  }
@@ -73,6 +80,23 @@ class Rename {
73
80
  }
74
81
  return workspace;
75
82
  }
83
+ renameMethod(params) {
84
+ var _a, _b;
85
+ const workspace = { documentChanges: [] };
86
+ const refs = new references_1.References(this.reg).references(params);
87
+ for (const r of refs) {
88
+ const doc = { uri: r.uri, version: 1 };
89
+ const edit = LServer.TextDocumentEdit.create(doc, [LServer.TextEdit.replace(r.range, params.newName)]);
90
+ (_a = workspace.documentChanges) === null || _a === void 0 ? void 0 : _a.push(edit);
91
+ }
92
+ const def = new definition_1.Definition(this.reg).find(params.textDocument, params.position);
93
+ if (def) {
94
+ const doc = { uri: params.textDocument.uri, version: 1 };
95
+ const edit = LServer.TextDocumentEdit.create(doc, [LServer.TextEdit.replace(def === null || def === void 0 ? void 0 : def.range, params.newName)]);
96
+ (_b = workspace.documentChanges) === null || _b === void 0 ? void 0 : _b.push(edit);
97
+ }
98
+ return workspace;
99
+ }
76
100
  }
77
101
  exports.Rename = Rename;
78
102
  //# sourceMappingURL=rename.js.map
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.101.7";
68
+ return "2.101.9";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -872,6 +872,9 @@ ${indentation}ENDIF.
872
872
  ${indentation}`);
873
873
  const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
874
874
  const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
875
+ if (high.get() instanceof Statements.ElseIf) {
876
+ throw "downport, unable to downport table expression in ELSEIF";
877
+ }
875
878
  return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Outline table expression", this.getMetadata().key, this.conf.severity, fix);
876
879
  }
877
880
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.101.7",
3
+ "version": "2.101.9",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "homepage": "https://abaplint.org",
50
50
  "devDependencies": {
51
- "@microsoft/api-extractor": "^7.35.0",
51
+ "@microsoft/api-extractor": "^7.35.1",
52
52
  "@types/chai": "^4.3.5",
53
53
  "@types/mocha": "^10.0.1",
54
54
  "@types/node": "^20.2.5",
55
55
  "chai": "^4.3.7",
56
56
  "eslint": "^8.41.0",
57
57
  "mocha": "^10.2.0",
58
- "c8": "^7.13.0",
58
+ "c8": "^7.14.0",
59
59
  "source-map-support": "^0.5.21",
60
60
  "ts-json-schema-generator": "^1.2.0",
61
61
  "typescript": "^5.0.4"