@abaplint/core 2.102.65 → 2.102.66
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.
|
@@ -8,6 +8,7 @@ const source_1 = require("./source");
|
|
|
8
8
|
const _object_oriented_1 = require("../_object_oriented");
|
|
9
9
|
const method_parameters_1 = require("./method_parameters");
|
|
10
10
|
const basic_types_1 = require("../basic_types");
|
|
11
|
+
const _type_utils_1 = require("../_type_utils");
|
|
11
12
|
class NewObject {
|
|
12
13
|
runSyntax(node, scope, targetType, filename) {
|
|
13
14
|
let ret = undefined;
|
|
@@ -89,7 +90,10 @@ class NewObject {
|
|
|
89
90
|
if (type === undefined) {
|
|
90
91
|
throw new Error("NewObject, no default importing parameter found for constructor, " + name);
|
|
91
92
|
}
|
|
92
|
-
new source_1.Source().runSyntax(source, scope, filename, type);
|
|
93
|
+
const sourceType = new source_1.Source().runSyntax(source, scope, filename, type);
|
|
94
|
+
if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, type) === false) {
|
|
95
|
+
throw new Error(`NEW parameter type not compatible`);
|
|
96
|
+
}
|
|
93
97
|
}
|
|
94
98
|
else if (parameters) {
|
|
95
99
|
// parameters with names
|
|
@@ -18,6 +18,9 @@ class Select {
|
|
|
18
18
|
const token = node.getFirstToken();
|
|
19
19
|
const from = node.findDirectExpression(Expressions.SQLFrom);
|
|
20
20
|
const dbSources = from ? new sql_from_1.SQLFrom().runSyntax(from, scope, filename) : [];
|
|
21
|
+
if (dbSources.length === 0) {
|
|
22
|
+
throw new Error(`Missing FROM`);
|
|
23
|
+
}
|
|
21
24
|
const fields = this.findFields(node);
|
|
22
25
|
if (fields.length === 0
|
|
23
26
|
&& node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
|
|
@@ -9,6 +9,7 @@ const _reference_1 = require("../_reference");
|
|
|
9
9
|
const basic_1 = require("../../types/basic");
|
|
10
10
|
const types_1 = require("../../types");
|
|
11
11
|
const _object_oriented_1 = require("../_object_oriented");
|
|
12
|
+
const _type_utils_1 = require("../_type_utils");
|
|
12
13
|
class CreateObject {
|
|
13
14
|
runSyntax(node, scope, filename) {
|
|
14
15
|
let cdef = undefined;
|
|
@@ -32,7 +33,7 @@ class CreateObject {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
// just recurse
|
|
35
|
-
for (const s of node.
|
|
36
|
+
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
36
37
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
37
38
|
}
|
|
38
39
|
let first = true;
|
|
@@ -76,26 +77,35 @@ class CreateObject {
|
|
|
76
77
|
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
77
78
|
new dynamic_1.Dynamic().runSyntax(t, scope, filename);
|
|
78
79
|
}
|
|
79
|
-
this.validateParameters(cdef, node, scope);
|
|
80
|
+
this.validateParameters(cdef, node, scope, filename);
|
|
80
81
|
}
|
|
81
|
-
validateParameters(cdef, node, scope) {
|
|
82
|
-
var _a, _b, _c;
|
|
82
|
+
validateParameters(cdef, node, scope, filename) {
|
|
83
|
+
var _a, _b, _c, _d;
|
|
83
84
|
if (cdef === undefined) {
|
|
85
|
+
const sources = (_a = node.findDirectExpression(Expressions.ParameterListS)) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source);
|
|
86
|
+
for (const s of sources || []) {
|
|
87
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
88
|
+
}
|
|
84
89
|
return;
|
|
85
90
|
}
|
|
86
91
|
const methodDef = new _object_oriented_1.ObjectOriented(scope).searchMethodName(cdef, "CONSTRUCTOR");
|
|
87
|
-
const methodParameters = (
|
|
92
|
+
const methodParameters = (_b = methodDef.method) === null || _b === void 0 ? void 0 : _b.getParameters();
|
|
88
93
|
const allImporting = (methodParameters === null || methodParameters === void 0 ? void 0 : methodParameters.getImporting()) || [];
|
|
89
94
|
const requiredImporting = new Set(methodParameters === null || methodParameters === void 0 ? void 0 : methodParameters.getRequiredParameters().map(i => i.getName().toUpperCase()));
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const name = (_c = p.findDirectExpression(Expressions.ParameterName)) === null || _c === void 0 ? void 0 : _c.concatTokens().toUpperCase();
|
|
95
|
+
for (const p of ((_c = node.findDirectExpression(Expressions.ParameterListS)) === null || _c === void 0 ? void 0 : _c.findAllExpressions(Expressions.ParameterS)) || []) {
|
|
96
|
+
const name = (_d = p.findDirectExpression(Expressions.ParameterName)) === null || _d === void 0 ? void 0 : _d.concatTokens().toUpperCase();
|
|
93
97
|
if (name === undefined) {
|
|
94
98
|
continue;
|
|
95
99
|
}
|
|
96
|
-
|
|
100
|
+
const source = p.findDirectExpression(Expressions.Source);
|
|
101
|
+
const sourceType = new source_1.Source().runSyntax(source, scope, filename);
|
|
102
|
+
const found = allImporting === null || allImporting === void 0 ? void 0 : allImporting.find(p => p.getName().toUpperCase() === name);
|
|
103
|
+
if (found === undefined) {
|
|
97
104
|
throw new Error(`constructor parameter "${name}" does not exist`);
|
|
98
105
|
}
|
|
106
|
+
else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, found.getType()) === false) {
|
|
107
|
+
throw new Error(`constructor parameter "${name}" type not compatible`);
|
|
108
|
+
}
|
|
99
109
|
requiredImporting.delete(name);
|
|
100
110
|
}
|
|
101
111
|
for (const r of requiredImporting.values()) {
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.102.
|
|
3
|
+
"version": "2.102.66",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.38.
|
|
53
|
+
"@microsoft/api-extractor": "^7.38.1",
|
|
54
54
|
"@types/chai": "^4.3.9",
|
|
55
55
|
"@types/mocha": "^10.0.3",
|
|
56
|
-
"@types/node": "^20.8.
|
|
56
|
+
"@types/node": "^20.8.10",
|
|
57
57
|
"chai": "^4.3.10",
|
|
58
58
|
"eslint": "^8.52.0",
|
|
59
59
|
"mocha": "^10.2.0",
|