@abaplint/core 2.85.12 → 2.85.16

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.
@@ -1480,7 +1480,8 @@ declare class Domain extends AbstractObject {
1480
1480
 
1481
1481
  declare interface DomainValue {
1482
1482
  language: string;
1483
- value: string;
1483
+ low: string;
1484
+ high: string;
1484
1485
  description: string;
1485
1486
  }
1486
1487
 
@@ -11,7 +11,7 @@ class Raise {
11
11
  const exporting = (0, combi_1.seq)("EXPORTING", expressions_1.ParameterListS);
12
12
  const from = (0, combi_1.seq)("TYPE", expressions_1.ClassName, (0, combi_1.opt)((0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v750, (0, combi_1.alt)(mess, messid)), (0, combi_1.ver)(version_1.Version.v752, "USING MESSAGE"))), (0, combi_1.optPrio)(exporting));
13
13
  const clas = (0, combi_1.seq)((0, combi_1.optPrio)("RESUMABLE"), "EXCEPTION", (0, combi_1.altPrio)(from, (0, combi_1.ver)(version_1.Version.v752, expressions_1.Source), expressions_1.SimpleSource2));
14
- const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.Field));
14
+ const ret = (0, combi_1.seq)("RAISE", (0, combi_1.altPrio)(clas, expressions_1.ExceptionName));
15
15
  return ret;
16
16
  }
17
17
  }
@@ -42,7 +42,7 @@ class BuiltInMethod extends _identifier_1.Identifier {
42
42
  }
43
43
  const keys = Object.keys(this.method.mandatory);
44
44
  if (keys.length === 1) {
45
- return keys[0];
45
+ return keys[0].toUpperCase();
46
46
  }
47
47
  return undefined;
48
48
  }
@@ -651,7 +651,7 @@ BuiltIn.methods = [
651
651
  {
652
652
  name: "LINE_EXISTS",
653
653
  mandatory: {
654
- "val": new basic_1.TableType(new basic_1.AnyType(), { withHeader: false }),
654
+ "val": new basic_1.AnyType(),
655
655
  },
656
656
  return: new basic_1.CharacterType(1),
657
657
  version: version_1.Version.v740sp02,
@@ -7,6 +7,9 @@ class TypeUtils {
7
7
  if (type === undefined) {
8
8
  return false;
9
9
  }
10
+ else if (type instanceof basic_1.TableType && type.isWithHeader()) {
11
+ return this.isCharLike(type.getRowType());
12
+ }
10
13
  else if (type instanceof basic_1.StructureType) {
11
14
  for (const c of type.getComponents()) {
12
15
  if (this.isCharLike(c.type) === false) {
@@ -515,7 +515,8 @@ class BasicTypes {
515
515
  }
516
516
  subs.shift();
517
517
  while (subs.length > 0) {
518
- if (foundType instanceof Types.UnknownType) {
518
+ if (foundType instanceof Types.UnknownType
519
+ || foundType instanceof Types.VoidType) {
519
520
  return foundType;
520
521
  }
521
522
  else if (!(foundType instanceof Types.StructureType)) {
@@ -25,7 +25,6 @@ class MethodCallParam {
25
25
  throw new Error("Parameter \"" + required[0].getName() + "\" must be supplied");
26
26
  }
27
27
  }
28
- return;
29
28
  }
30
29
  else if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.Source) {
31
30
  if (!(method instanceof basic_1.VoidType) && method.getParameters().getImporting().length === 0) {
@@ -7,6 +7,7 @@ const nodes_1 = require("../../nodes");
7
7
  const inline_data_1 = require("./inline_data");
8
8
  const target_1 = require("./target");
9
9
  const source_1 = require("./source");
10
+ const _type_utils_1 = require("../_type_utils");
10
11
  class MethodParameters {
11
12
  constructor() {
12
13
  this.requiredParameters = undefined;
@@ -63,7 +64,10 @@ class MethodParameters {
63
64
  new inline_data_1.InlineData().runSyntax(inline, scope, filename, type);
64
65
  }
65
66
  else if (target) {
66
- new target_1.Target().runSyntax(target, scope, filename);
67
+ const targetType = new target_1.Target().runSyntax(target, scope, filename);
68
+ if (targetType && _type_utils_1.TypeUtils.isAssignable(type, targetType) === false) {
69
+ throw new Error("Method returning value not type compatible");
70
+ }
67
71
  }
68
72
  }
69
73
  checkImporting(node, scope, method, filename) {
@@ -86,8 +90,8 @@ class MethodParameters {
86
90
  else if (item.targetType === undefined) {
87
91
  throw new Error("Could not determine target type");
88
92
  }
89
- else if (item.targetType) {
90
- // todo, check that targetType and parameterType are compatible
93
+ else if (item.targetType && _type_utils_1.TypeUtils.isAssignable(parameterType, item.targetType) === false) {
94
+ throw new Error("Method parameter type not compatible, " + item.name);
91
95
  }
92
96
  }
93
97
  }
@@ -105,34 +109,28 @@ class MethodParameters {
105
109
  }
106
110
  parameterType = parameter.getType();
107
111
  }
108
- if (item.targetType) {
109
- // todo, check that targetType and parameterType are compatible
110
- if (0) {
111
- console.log(parameterType); // todo
112
- }
112
+ if (item.targetType && _type_utils_1.TypeUtils.isAssignable(parameterType, item.targetType) === false) {
113
+ throw new Error("Method parameter type not compatible, " + item.name);
113
114
  }
114
115
  (_a = this.requiredParameters) === null || _a === void 0 ? void 0 : _a.delete(item.name);
115
116
  }
116
117
  }
117
118
  checkExporting(node, scope, method, filename, errors = true) {
119
+ const items = this.parameterListS(node, scope, filename, method);
118
120
  if (method instanceof basic_1.VoidType) {
119
- this.parameterListS(node, scope, filename, method);
120
121
  return;
121
122
  }
122
123
  const allImporting = method.getParameters().getImporting();
123
124
  if (this.requiredParameters === undefined) {
124
125
  this.requiredParameters = new Set(method.getParameters().getRequiredParameters().map(i => i.getName().toUpperCase()));
125
126
  }
126
- for (const item of this.parameterListS(node, scope, filename, method)) {
127
- let parameterType = undefined;
127
+ for (const item of items) {
128
128
  const parameter = allImporting.find(p => p.getName().toUpperCase() === item.name);
129
129
  if (parameter === undefined) {
130
130
  throw new Error("Method importing parameter \"" + item.name + "\" does not exist");
131
131
  }
132
- parameterType = parameter.getType();
133
- // todo, check that targetType and parameterType are compatible
134
- if (0) {
135
- console.log(parameterType); // todo
132
+ else if (_type_utils_1.TypeUtils.isAssignable(parameter.getType(), item.sourceType) === false) {
133
+ throw new Error("Method parameter type not compatible, " + item.name);
136
134
  }
137
135
  this.requiredParameters.delete(item.name);
138
136
  }
@@ -52,7 +52,8 @@ class Domain extends _abstract_object_1.AbstractObject {
52
52
  for (const ddo7v of dd07v_tab) {
53
53
  const value = {
54
54
  description: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DDTEXT,
55
- value: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DOMVALUE_L,
55
+ low: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DOMVALUE_L,
56
+ high: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DOMVALUE_H,
56
57
  language: ddo7v === null || ddo7v === void 0 ? void 0 : ddo7v.DDLANGUAGE,
57
58
  };
58
59
  values.push(value);
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.85.12";
71
+ return "2.85.16";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -61,7 +61,7 @@ class ConstantClasses {
61
61
  return [];
62
62
  }
63
63
  const domainValueInfo = obj.getFixedValues();
64
- const domainValues = domainValueInfo.map(x => x.value);
64
+ const domainValues = domainValueInfo.map(x => x.low);
65
65
  const issues = [];
66
66
  if (obj.getFixedValues().length === 0) {
67
67
  // possibly this is not even a domain with fixed values
@@ -94,8 +94,8 @@ class ConstantClasses {
94
94
  }
95
95
  }
96
96
  for (const d of domainValueInfo) {
97
- if (!def.constants.find(c => c.value === d.value)) {
98
- issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant for ${d.value} (domain ${configEntry.domain})`, this.getMetadata().key, this.conf.severity));
97
+ if (!def.constants.find(c => c.value === d.low)) {
98
+ issues.push(issue_1.Issue.atStatement(classContents, classContents.getStatements()[0], `Missing constant for ${d.low} (domain ${configEntry.domain})`, this.getMetadata().key, this.conf.severity));
99
99
  // quickfix will add constant
100
100
  }
101
101
  }
@@ -44,8 +44,12 @@ class SuperclassFinal extends _abap_rule_1.ABAPRule {
44
44
  }
45
45
  let found = undefined;
46
46
  if (localLookup) {
47
- // todo, this should look inside the object instead of the file?
48
- found = file.getInfo().getClassDefinitionByName(sup);
47
+ for (const f of obj.getABAPFiles()) {
48
+ found = f.getInfo().getClassDefinitionByName(sup);
49
+ if (found !== undefined) {
50
+ break;
51
+ }
52
+ }
49
53
  }
50
54
  if (found === undefined) {
51
55
  const clas = this.reg.getObject("CLAS", sup);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.85.12",
3
+ "version": "2.85.16",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@microsoft/api-extractor": "^7.19.4",
49
49
  "@types/chai": "^4.3.0",
50
50
  "@types/mocha": "^9.1.0",
51
- "@types/node": "^17.0.15",
51
+ "@types/node": "^17.0.17",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.8.0",
54
54
  "mocha": "^9.2.0",