@abaplint/transpiler-cli 2.6.15 → 2.6.17
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.
- package/build/bundle.js +196 -43
- package/package.json +4 -4
package/build/bundle.js
CHANGED
|
@@ -12686,7 +12686,8 @@ class Message {
|
|
|
12686
12686
|
const mwith = (0, combi_1.seq)("WITH", s, (0, combi_1.opt)(sourc));
|
|
12687
12687
|
const foo = (0, combi_1.seq)(expressions_1.MessageSource, (0, combi_1.opt)(options), (0, combi_1.opt)(mwith));
|
|
12688
12688
|
const text = (0, combi_1.seq)(s, type, (0, combi_1.optPrio)(like), (0, combi_1.optPrio)(raising));
|
|
12689
|
-
const
|
|
12689
|
+
const cloud = (0, combi_1.seq)(expressions_1.MessageSource, (0, combi_1.opt)((0, combi_1.seq)("WITH", expressions_1.Source, (0, combi_1.opt)(expressions_1.Source), (0, combi_1.opt)(expressions_1.Source), (0, combi_1.opt)(expressions_1.Source))), into);
|
|
12690
|
+
const ret = (0, combi_1.seq)("MESSAGE", (0, combi_1.altPrio)((0, combi_1.verNot)(version_1.Version.Cloud, foo), (0, combi_1.verNot)(version_1.Version.Cloud, text), (0, combi_1.ver)(version_1.Version.Cloud, cloud)));
|
|
12690
12691
|
return ret;
|
|
12691
12692
|
}
|
|
12692
12693
|
}
|
|
@@ -18342,7 +18343,7 @@ class BuiltIn {
|
|
|
18342
18343
|
ret.push(this.buildConstant("col_normal", new basic_1.IntegerType(), "2"));
|
|
18343
18344
|
ret.push(this.buildConstant("col_positive", new basic_1.IntegerType(), "5"));
|
|
18344
18345
|
ret.push(this.buildConstant("col_total", new basic_1.IntegerType(), "3"));
|
|
18345
|
-
ret.push(this.buildConstant("space", new basic_1.CharacterType(1), "' '"));
|
|
18346
|
+
ret.push(this.buildConstant("space", new basic_1.CharacterType(1, { derivedFromConstant: true }), "' '"));
|
|
18346
18347
|
for (const e of extras) {
|
|
18347
18348
|
const id = new tokens_1.Identifier(new position_1.Position(this.row++, 1), e);
|
|
18348
18349
|
ret.push(new _typed_identifier_1.TypedIdentifier(id, BuiltIn.filename, new basic_1.VoidType(e), ["read_only" /* IdentifierMeta.ReadOnly */, "built-in" /* IdentifierMeta.BuiltIn */], "'?'"));
|
|
@@ -19547,6 +19548,9 @@ class CurrentScope {
|
|
|
19547
19548
|
/** Lookup interface in local and global scope */
|
|
19548
19549
|
findInterfaceDefinition(name) {
|
|
19549
19550
|
var _a;
|
|
19551
|
+
if (name === undefined) {
|
|
19552
|
+
return undefined;
|
|
19553
|
+
}
|
|
19550
19554
|
const ilocal = (_a = this.current) === null || _a === void 0 ? void 0 : _a.findInterfaceDefinition(name);
|
|
19551
19555
|
if (ilocal) {
|
|
19552
19556
|
return ilocal;
|
|
@@ -20254,6 +20258,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
20254
20258
|
exports.TypeUtils = void 0;
|
|
20255
20259
|
const types_1 = __webpack_require__(/*! ../types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
|
|
20256
20260
|
const basic_1 = __webpack_require__(/*! ../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
20261
|
+
const cgeneric_type_1 = __webpack_require__(/*! ../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
|
|
20257
20262
|
class TypeUtils {
|
|
20258
20263
|
constructor(scope) {
|
|
20259
20264
|
this.scope = scope;
|
|
@@ -20274,6 +20279,7 @@ class TypeUtils {
|
|
|
20274
20279
|
|| type instanceof basic_1.AnyType
|
|
20275
20280
|
|| type instanceof basic_1.CharacterType
|
|
20276
20281
|
|| type instanceof basic_1.SimpleType
|
|
20282
|
+
|| type instanceof cgeneric_type_1.CGenericType
|
|
20277
20283
|
|| type instanceof basic_1.CLikeType
|
|
20278
20284
|
|| type instanceof basic_1.DateType
|
|
20279
20285
|
|| type instanceof basic_1.CSequenceType
|
|
@@ -20302,6 +20308,7 @@ class TypeUtils {
|
|
|
20302
20308
|
return true;
|
|
20303
20309
|
}
|
|
20304
20310
|
else if (type instanceof basic_1.StringType
|
|
20311
|
+
|| type instanceof basic_1.CharacterType
|
|
20305
20312
|
|| type instanceof basic_1.VoidType
|
|
20306
20313
|
|| type instanceof basic_1.AnyType
|
|
20307
20314
|
|| type instanceof basic_1.UnknownType
|
|
@@ -20315,11 +20322,11 @@ class TypeUtils {
|
|
|
20315
20322
|
|| type instanceof basic_1.DecFloat34Type
|
|
20316
20323
|
|| type instanceof basic_1.NumericGenericType
|
|
20317
20324
|
|| type instanceof basic_1.CSequenceType
|
|
20325
|
+
|| type instanceof cgeneric_type_1.CGenericType
|
|
20318
20326
|
|| type instanceof basic_1.DateType
|
|
20319
20327
|
|| type instanceof basic_1.CLikeType
|
|
20320
20328
|
|| type instanceof basic_1.PackedType
|
|
20321
|
-
|| type instanceof basic_1.TimeType
|
|
20322
|
-
|| type instanceof basic_1.CharacterType) {
|
|
20329
|
+
|| type instanceof basic_1.TimeType) {
|
|
20323
20330
|
return true;
|
|
20324
20331
|
}
|
|
20325
20332
|
return false;
|
|
@@ -20438,6 +20445,55 @@ class TypeUtils {
|
|
|
20438
20445
|
// todo
|
|
20439
20446
|
return true;
|
|
20440
20447
|
}
|
|
20448
|
+
structureContainsString(structure) {
|
|
20449
|
+
for (const c of structure.getComponents()) {
|
|
20450
|
+
if (c.type instanceof basic_1.StringType) {
|
|
20451
|
+
return true;
|
|
20452
|
+
}
|
|
20453
|
+
}
|
|
20454
|
+
return false;
|
|
20455
|
+
}
|
|
20456
|
+
isAssignableStrict(source, target) {
|
|
20457
|
+
var _a, _b;
|
|
20458
|
+
/*
|
|
20459
|
+
console.dir(source);
|
|
20460
|
+
console.dir(target);
|
|
20461
|
+
*/
|
|
20462
|
+
if (source instanceof basic_1.CharacterType) {
|
|
20463
|
+
if (target instanceof basic_1.CharacterType) {
|
|
20464
|
+
if (((_a = source.getAbstractTypeData()) === null || _a === void 0 ? void 0 : _a.derivedFromConstant) === true) {
|
|
20465
|
+
return source.getLength() <= target.getLength();
|
|
20466
|
+
}
|
|
20467
|
+
return source.getLength() === target.getLength();
|
|
20468
|
+
}
|
|
20469
|
+
else if (target instanceof basic_1.IntegerType) {
|
|
20470
|
+
if (((_b = source.getAbstractTypeData()) === null || _b === void 0 ? void 0 : _b.derivedFromConstant) === true) {
|
|
20471
|
+
return true;
|
|
20472
|
+
}
|
|
20473
|
+
return false;
|
|
20474
|
+
}
|
|
20475
|
+
}
|
|
20476
|
+
else if (source instanceof basic_1.StringType && target instanceof basic_1.StructureType) {
|
|
20477
|
+
if (this.structureContainsString(target)) {
|
|
20478
|
+
return false;
|
|
20479
|
+
}
|
|
20480
|
+
return true;
|
|
20481
|
+
}
|
|
20482
|
+
else if (source instanceof basic_1.StructureType && target instanceof basic_1.StructureType) {
|
|
20483
|
+
const sourceComponents = source.getComponents();
|
|
20484
|
+
const targetComponents = target.getComponents();
|
|
20485
|
+
if (sourceComponents.length !== targetComponents.length) {
|
|
20486
|
+
return false;
|
|
20487
|
+
}
|
|
20488
|
+
for (let i = 0; i < sourceComponents.length; i++) {
|
|
20489
|
+
if (this.isAssignableStrict(sourceComponents[i].type, targetComponents[i].type) === false) {
|
|
20490
|
+
return false;
|
|
20491
|
+
}
|
|
20492
|
+
}
|
|
20493
|
+
return true;
|
|
20494
|
+
}
|
|
20495
|
+
return this.isAssignable(source, target);
|
|
20496
|
+
}
|
|
20441
20497
|
isAssignable(source, target) {
|
|
20442
20498
|
/*
|
|
20443
20499
|
console.dir(source);
|
|
@@ -20447,12 +20503,38 @@ class TypeUtils {
|
|
|
20447
20503
|
if (target.isWithHeader()) {
|
|
20448
20504
|
return this.isAssignable(source, target.getRowType());
|
|
20449
20505
|
}
|
|
20450
|
-
if (source instanceof basic_1.
|
|
20451
|
-
|| source instanceof basic_1.VoidType
|
|
20506
|
+
if (source instanceof basic_1.VoidType
|
|
20452
20507
|
|| source instanceof basic_1.AnyType
|
|
20453
20508
|
|| source instanceof basic_1.UnknownType) {
|
|
20454
20509
|
return true;
|
|
20455
20510
|
}
|
|
20511
|
+
else if (source instanceof basic_1.TableType) {
|
|
20512
|
+
const targetRowType = target.getRowType();
|
|
20513
|
+
const sourceRowType = source.getRowType();
|
|
20514
|
+
if (targetRowType instanceof basic_1.VoidType || targetRowType instanceof basic_1.AnyType || targetRowType instanceof basic_1.UnknownType) {
|
|
20515
|
+
return true;
|
|
20516
|
+
}
|
|
20517
|
+
else if (sourceRowType instanceof basic_1.VoidType || sourceRowType instanceof basic_1.AnyType || sourceRowType instanceof basic_1.UnknownType) {
|
|
20518
|
+
return true;
|
|
20519
|
+
}
|
|
20520
|
+
if (targetRowType instanceof basic_1.StructureType && this.structureContainsString(targetRowType)) {
|
|
20521
|
+
if (!(sourceRowType instanceof basic_1.StructureType)) {
|
|
20522
|
+
return false;
|
|
20523
|
+
}
|
|
20524
|
+
else if (!(this.structureContainsString(sourceRowType))) {
|
|
20525
|
+
return false;
|
|
20526
|
+
}
|
|
20527
|
+
}
|
|
20528
|
+
if (sourceRowType instanceof basic_1.StructureType && this.structureContainsString(sourceRowType)) {
|
|
20529
|
+
if (!(targetRowType instanceof basic_1.StructureType)) {
|
|
20530
|
+
return false;
|
|
20531
|
+
}
|
|
20532
|
+
else if (!(this.structureContainsString(targetRowType))) {
|
|
20533
|
+
return false;
|
|
20534
|
+
}
|
|
20535
|
+
}
|
|
20536
|
+
return true;
|
|
20537
|
+
}
|
|
20456
20538
|
return false;
|
|
20457
20539
|
}
|
|
20458
20540
|
else if (target instanceof basic_1.ObjectReferenceType && source instanceof basic_1.ObjectReferenceType) {
|
|
@@ -20482,12 +20564,17 @@ class TypeUtils {
|
|
|
20482
20564
|
if (source instanceof basic_1.TableType && source.isWithHeader()) {
|
|
20483
20565
|
return this.isAssignable(source.getRowType(), target);
|
|
20484
20566
|
}
|
|
20485
|
-
else if (source instanceof basic_1.
|
|
20486
|
-
|| source instanceof basic_1.VoidType
|
|
20567
|
+
else if (source instanceof basic_1.VoidType
|
|
20487
20568
|
|| source instanceof basic_1.AnyType
|
|
20488
20569
|
|| source instanceof basic_1.UnknownType) {
|
|
20489
20570
|
return true;
|
|
20490
20571
|
}
|
|
20572
|
+
else if (source instanceof basic_1.StructureType) {
|
|
20573
|
+
if (this.structureContainsString(target) && !this.structureContainsString(source)) {
|
|
20574
|
+
return false;
|
|
20575
|
+
}
|
|
20576
|
+
return true;
|
|
20577
|
+
}
|
|
20491
20578
|
else if (target.containsVoid() === true) {
|
|
20492
20579
|
return true;
|
|
20493
20580
|
}
|
|
@@ -21997,7 +22084,7 @@ class Constant {
|
|
|
21997
22084
|
if (len <= 0) {
|
|
21998
22085
|
len = 1;
|
|
21999
22086
|
}
|
|
22000
|
-
return new basic_1.CharacterType(len);
|
|
22087
|
+
return new basic_1.CharacterType(len, { derivedFromConstant: true });
|
|
22001
22088
|
}
|
|
22002
22089
|
else {
|
|
22003
22090
|
return new basic_1.StringType({ qualifiedName: "STRING" });
|
|
@@ -23007,6 +23094,7 @@ class MethodCallBody {
|
|
|
23007
23094
|
if (param) {
|
|
23008
23095
|
new method_call_param_1.MethodCallParam().runSyntax(param, scope, method, filename);
|
|
23009
23096
|
}
|
|
23097
|
+
// for PARAMETER-TABLE and EXCEPTION-TABLE
|
|
23010
23098
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
23011
23099
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
23012
23100
|
}
|
|
@@ -23218,7 +23306,7 @@ class MethodCallParam {
|
|
|
23218
23306
|
if (sourceType === undefined) {
|
|
23219
23307
|
throw new Error("No source type determined, method source");
|
|
23220
23308
|
}
|
|
23221
|
-
else if (new _type_utils_1.TypeUtils(scope).
|
|
23309
|
+
else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(sourceType, targetType) === false) {
|
|
23222
23310
|
throw new Error("Method parameter type not compatible");
|
|
23223
23311
|
}
|
|
23224
23312
|
}
|
|
@@ -23295,6 +23383,7 @@ const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@ab
|
|
|
23295
23383
|
const basic_types_1 = __webpack_require__(/*! ../basic_types */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/basic_types.js");
|
|
23296
23384
|
const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
23297
23385
|
const default_1 = __webpack_require__(/*! ./default */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/default.js");
|
|
23386
|
+
const cgeneric_type_1 = __webpack_require__(/*! ../../types/basic/cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js");
|
|
23298
23387
|
class MethodParam {
|
|
23299
23388
|
runSyntax(node, scope, filename, meta) {
|
|
23300
23389
|
const name = node.findDirectExpression(Expressions.MethodParamName);
|
|
@@ -23314,6 +23403,10 @@ class MethodParam {
|
|
|
23314
23403
|
return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), filename, new basic_1.UnknownType(e.toString()), meta);
|
|
23315
23404
|
}
|
|
23316
23405
|
}
|
|
23406
|
+
const concat = type.concatTokens().toUpperCase();
|
|
23407
|
+
if (concat === "TYPE C" || concat.startsWith("TYPE C ")) {
|
|
23408
|
+
return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), filename, new cgeneric_type_1.CGenericType(), meta);
|
|
23409
|
+
}
|
|
23317
23410
|
const found = new basic_types_1.BasicTypes(filename, scope).parseType(type);
|
|
23318
23411
|
if (found) {
|
|
23319
23412
|
return new _typed_identifier_1.TypedIdentifier(name.getFirstToken(), filename, found, meta);
|
|
@@ -23466,7 +23559,7 @@ class MethodParameters {
|
|
|
23466
23559
|
if (parameter === undefined) {
|
|
23467
23560
|
throw new Error("Method importing parameter \"" + item.name + "\" does not exist");
|
|
23468
23561
|
}
|
|
23469
|
-
else if (new _type_utils_1.TypeUtils(scope).
|
|
23562
|
+
else if (new _type_utils_1.TypeUtils(scope).isAssignableStrict(item.sourceType, parameter.getType()) === false) {
|
|
23470
23563
|
throw new Error("Method parameter type not compatible, " + item.name);
|
|
23471
23564
|
}
|
|
23472
23565
|
this.requiredParameters.delete(item.name);
|
|
@@ -26449,6 +26542,11 @@ class CreateObject {
|
|
|
26449
26542
|
if (id instanceof types_1.InterfaceDefinition && type === undefined) {
|
|
26450
26543
|
throw new Error("Interface reference, cannot be instantiated");
|
|
26451
26544
|
}
|
|
26545
|
+
else if (found instanceof basic_1.ObjectReferenceType
|
|
26546
|
+
&& type === undefined
|
|
26547
|
+
&& scope.findInterfaceDefinition(found.getQualifiedName())) {
|
|
26548
|
+
throw new Error("Interface reference, cannot be instantiated");
|
|
26549
|
+
}
|
|
26452
26550
|
else if (id instanceof types_1.ClassDefinition && cdef === undefined) {
|
|
26453
26551
|
cdef = id;
|
|
26454
26552
|
}
|
|
@@ -32601,6 +32699,39 @@ exports.AnyType = AnyType;
|
|
|
32601
32699
|
|
|
32602
32700
|
/***/ }),
|
|
32603
32701
|
|
|
32702
|
+
/***/ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js":
|
|
32703
|
+
/*!*********************************************************************************!*\
|
|
32704
|
+
!*** ./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js ***!
|
|
32705
|
+
\*********************************************************************************/
|
|
32706
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
32707
|
+
|
|
32708
|
+
"use strict";
|
|
32709
|
+
|
|
32710
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32711
|
+
exports.CGenericType = void 0;
|
|
32712
|
+
const _abstract_type_1 = __webpack_require__(/*! ./_abstract_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/_abstract_type.js");
|
|
32713
|
+
class CGenericType extends _abstract_type_1.AbstractType {
|
|
32714
|
+
toText() {
|
|
32715
|
+
return "```c```";
|
|
32716
|
+
}
|
|
32717
|
+
isGeneric() {
|
|
32718
|
+
return true;
|
|
32719
|
+
}
|
|
32720
|
+
toABAP() {
|
|
32721
|
+
throw new Error("c, generic");
|
|
32722
|
+
}
|
|
32723
|
+
containsVoid() {
|
|
32724
|
+
return false;
|
|
32725
|
+
}
|
|
32726
|
+
toCDS() {
|
|
32727
|
+
return "abap.TODO_CGENERIC";
|
|
32728
|
+
}
|
|
32729
|
+
}
|
|
32730
|
+
exports.CGenericType = CGenericType;
|
|
32731
|
+
//# sourceMappingURL=cgeneric_type.js.map
|
|
32732
|
+
|
|
32733
|
+
/***/ }),
|
|
32734
|
+
|
|
32604
32735
|
/***/ "./node_modules/@abaplint/core/build/src/abap/types/basic/character_type.js":
|
|
32605
32736
|
/*!**********************************************************************************!*\
|
|
32606
32737
|
!*** ./node_modules/@abaplint/core/build/src/abap/types/basic/character_type.js ***!
|
|
@@ -33113,6 +33244,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
33113
33244
|
};
|
|
33114
33245
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
33115
33246
|
__exportStar(__webpack_require__(/*! ./any_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/any_type.js"), exports);
|
|
33247
|
+
__exportStar(__webpack_require__(/*! ./cgeneric_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/cgeneric_type.js"), exports);
|
|
33116
33248
|
__exportStar(__webpack_require__(/*! ./character_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/character_type.js"), exports);
|
|
33117
33249
|
__exportStar(__webpack_require__(/*! ./clike_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/clike_type.js"), exports);
|
|
33118
33250
|
__exportStar(__webpack_require__(/*! ./csequence_type */ "./node_modules/@abaplint/core/build/src/abap/types/basic/csequence_type.js"), exports);
|
|
@@ -46226,7 +46358,7 @@ class Registry {
|
|
|
46226
46358
|
}
|
|
46227
46359
|
static abaplintVersion() {
|
|
46228
46360
|
// magic, see build script "version.sh"
|
|
46229
|
-
return "2.97.
|
|
46361
|
+
return "2.97.12";
|
|
46230
46362
|
}
|
|
46231
46363
|
getDDICReferences() {
|
|
46232
46364
|
return this.references;
|
|
@@ -67010,12 +67142,14 @@ class Chunk {
|
|
|
67010
67142
|
this.appendString(str);
|
|
67011
67143
|
}
|
|
67012
67144
|
}
|
|
67013
|
-
|
|
67145
|
+
/*
|
|
67146
|
+
public copy(): Chunk {
|
|
67014
67147
|
const ret = new Chunk();
|
|
67015
67148
|
ret.raw = this.raw;
|
|
67016
67149
|
ret.mappings = [...this.mappings];
|
|
67017
67150
|
return ret;
|
|
67018
|
-
|
|
67151
|
+
}
|
|
67152
|
+
*/
|
|
67019
67153
|
join(chunks, str = ", ") {
|
|
67020
67154
|
for (let i = 0; i < chunks.length; i++) {
|
|
67021
67155
|
this.appendChunk(chunks[i]);
|
|
@@ -67032,7 +67166,7 @@ class Chunk {
|
|
|
67032
67166
|
const lines = this.raw.split("\n");
|
|
67033
67167
|
const lineCount = lines.length;
|
|
67034
67168
|
const lastLine = lines[lines.length - 1];
|
|
67035
|
-
append.mappings
|
|
67169
|
+
for (const m of append.mappings) {
|
|
67036
67170
|
// original stays the same, but adjust the generated positions
|
|
67037
67171
|
const add = m;
|
|
67038
67172
|
if (add.generated.line === 1 && this.raw.endsWith("\n") === false) {
|
|
@@ -67042,7 +67176,7 @@ class Chunk {
|
|
|
67042
67176
|
add.generated.line += lineCount - 1;
|
|
67043
67177
|
}
|
|
67044
67178
|
this.mappings.push(add);
|
|
67045
|
-
}
|
|
67179
|
+
}
|
|
67046
67180
|
this.raw += append.getCode();
|
|
67047
67181
|
return this;
|
|
67048
67182
|
}
|
|
@@ -77298,6 +77432,7 @@ class TranspileTypes {
|
|
|
77298
77432
|
}
|
|
77299
77433
|
}
|
|
77300
77434
|
else if (type instanceof abaplint.BasicTypes.CLikeType
|
|
77435
|
+
|| type instanceof abaplint.BasicTypes.CGenericType
|
|
77301
77436
|
|| type instanceof abaplint.BasicTypes.CSequenceType) {
|
|
77302
77437
|
// if not supplied its a Character(1)
|
|
77303
77438
|
resolved = "Character";
|
|
@@ -77654,21 +77789,28 @@ class Traversal {
|
|
|
77654
77789
|
if (ref === undefined) {
|
|
77655
77790
|
return undefined;
|
|
77656
77791
|
}
|
|
77657
|
-
// local
|
|
77792
|
+
// local
|
|
77658
77793
|
if (ref.getFilename() === this.getFilename()) {
|
|
77659
77794
|
const scope = this.findCurrentScopeByToken(ref.getToken());
|
|
77660
77795
|
if ((scope === null || scope === void 0 ? void 0 : scope.getIdentifier().stype) === abaplint.ScopeType.Interface) {
|
|
77661
77796
|
return scope === null || scope === void 0 ? void 0 : scope.getIdentifier().sname;
|
|
77662
77797
|
}
|
|
77663
77798
|
}
|
|
77664
|
-
// global
|
|
77665
|
-
const
|
|
77666
|
-
|
|
77667
|
-
const obj = this.reg.findObjectForFile(file);
|
|
77668
|
-
if ((obj === null || obj === void 0 ? void 0 : obj.getType()) === "INTF") {
|
|
77799
|
+
// global
|
|
77800
|
+
for (const obj of this.reg.getObjectsByType("INTF")) {
|
|
77801
|
+
if (obj.getFiles().some(f => f.getFilename() === ref.getFilename())) {
|
|
77669
77802
|
return obj.getName().toLowerCase();
|
|
77670
77803
|
}
|
|
77671
77804
|
}
|
|
77805
|
+
/*
|
|
77806
|
+
const file = this.reg.getFileByName(ref.getFilename());
|
|
77807
|
+
if (file) {
|
|
77808
|
+
const obj = this.reg.findObjectForFile(file);
|
|
77809
|
+
if (obj?.getType() === "INTF") {
|
|
77810
|
+
return obj.getName().toLowerCase();
|
|
77811
|
+
}
|
|
77812
|
+
}
|
|
77813
|
+
*/
|
|
77672
77814
|
return undefined;
|
|
77673
77815
|
}
|
|
77674
77816
|
findReadOrWriteReference(token) {
|
|
@@ -77850,7 +77992,7 @@ class Traversal {
|
|
|
77850
77992
|
}
|
|
77851
77993
|
const name = def.getName();
|
|
77852
77994
|
if (def.isGlobal() === false) {
|
|
77853
|
-
const prefix = this.buildPrefix(
|
|
77995
|
+
const prefix = this.buildPrefix();
|
|
77854
77996
|
return `abap.Classes['${prefix}-${name.toUpperCase()}'] = ${Traversal.escapeNamespace(name.toLowerCase())};`;
|
|
77855
77997
|
}
|
|
77856
77998
|
else {
|
|
@@ -77896,7 +78038,7 @@ class Traversal {
|
|
|
77896
78038
|
}
|
|
77897
78039
|
if (def) {
|
|
77898
78040
|
if (def.isGlobal() === false) {
|
|
77899
|
-
const prefix = this.buildPrefix(
|
|
78041
|
+
const prefix = this.buildPrefix();
|
|
77900
78042
|
return `abap.Classes['${prefix}-${(_a = def === null || def === void 0 ? void 0 : def.getName()) === null || _a === void 0 ? void 0 : _a.toUpperCase()}']`;
|
|
77901
78043
|
}
|
|
77902
78044
|
else {
|
|
@@ -77908,13 +78050,8 @@ class Traversal {
|
|
|
77908
78050
|
return "abap.Classes['" + name.toUpperCase() + "']";
|
|
77909
78051
|
}
|
|
77910
78052
|
}
|
|
77911
|
-
buildPrefix(
|
|
77912
|
-
|
|
77913
|
-
if (file === undefined) {
|
|
77914
|
-
return "NOT_FOUND";
|
|
77915
|
-
}
|
|
77916
|
-
const obj = this.reg.findObjectForFile(file);
|
|
77917
|
-
return (obj === null || obj === void 0 ? void 0 : obj.getType()) + "-" + (obj === null || obj === void 0 ? void 0 : obj.getName());
|
|
78053
|
+
buildPrefix() {
|
|
78054
|
+
return this.obj.getType() + "-" + this.obj.getName();
|
|
77918
78055
|
}
|
|
77919
78056
|
////////////////////////////
|
|
77920
78057
|
traverseStructure(node) {
|
|
@@ -79842,6 +79979,10 @@ const defaultOptions = {
|
|
|
79842
79979
|
ignorePiTags: false,
|
|
79843
79980
|
transformTagName: false,
|
|
79844
79981
|
transformAttributeName: false,
|
|
79982
|
+
updateTag: function(tagName, jPath, attrs){
|
|
79983
|
+
return tagName
|
|
79984
|
+
},
|
|
79985
|
+
// skipEmptyListItem: false
|
|
79845
79986
|
};
|
|
79846
79987
|
|
|
79847
79988
|
const buildOptions = function(options) {
|
|
@@ -79912,6 +80053,7 @@ class OrderedObjParser{
|
|
|
79912
80053
|
this.replaceEntitiesValue = replaceEntitiesValue;
|
|
79913
80054
|
this.readStopNodeData = readStopNodeData;
|
|
79914
80055
|
this.saveTextToParentTag = saveTextToParentTag;
|
|
80056
|
+
this.addChild = addChild;
|
|
79915
80057
|
}
|
|
79916
80058
|
|
|
79917
80059
|
}
|
|
@@ -79983,7 +80125,7 @@ function resolveNameSpace(tagname) {
|
|
|
79983
80125
|
//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
|
|
79984
80126
|
const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
|
|
79985
80127
|
|
|
79986
|
-
function buildAttributesMap(attrStr, jPath) {
|
|
80128
|
+
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
79987
80129
|
if (!this.options.ignoreAttributes && typeof attrStr === 'string') {
|
|
79988
80130
|
// attrStr = attrStr.replace(/\r?\n/g, ' ');
|
|
79989
80131
|
//attrStr = attrStr || attrStr.trim();
|
|
@@ -80033,7 +80175,7 @@ function buildAttributesMap(attrStr, jPath) {
|
|
|
80033
80175
|
attrCollection[this.options.attributesGroupName] = attrs;
|
|
80034
80176
|
return attrCollection;
|
|
80035
80177
|
}
|
|
80036
|
-
return attrs
|
|
80178
|
+
return attrs
|
|
80037
80179
|
}
|
|
80038
80180
|
}
|
|
80039
80181
|
|
|
@@ -80069,7 +80211,7 @@ const parseXml = function(xmlData) {
|
|
|
80069
80211
|
|
|
80070
80212
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
80071
80213
|
|
|
80072
|
-
currentNode = this.tagsNodeStack.pop();//avoid
|
|
80214
|
+
currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
|
|
80073
80215
|
textData = "";
|
|
80074
80216
|
i = closeIndex;
|
|
80075
80217
|
} else if( xmlData[i+1] === '?') {
|
|
@@ -80086,9 +80228,9 @@ const parseXml = function(xmlData) {
|
|
|
80086
80228
|
childNode.add(this.options.textNodeName, "");
|
|
80087
80229
|
|
|
80088
80230
|
if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){
|
|
80089
|
-
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath);
|
|
80231
|
+
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
|
|
80090
80232
|
}
|
|
80091
|
-
|
|
80233
|
+
this.addChild(currentNode, childNode, jPath)
|
|
80092
80234
|
|
|
80093
80235
|
}
|
|
80094
80236
|
|
|
@@ -80176,7 +80318,7 @@ const parseXml = function(xmlData) {
|
|
|
80176
80318
|
|
|
80177
80319
|
const childNode = new xmlNode(tagName);
|
|
80178
80320
|
if(tagName !== tagExp && attrExpPresent){
|
|
80179
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
80321
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
80180
80322
|
}
|
|
80181
80323
|
if(tagContent) {
|
|
80182
80324
|
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
@@ -80185,7 +80327,7 @@ const parseXml = function(xmlData) {
|
|
|
80185
80327
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
80186
80328
|
childNode.add(this.options.textNodeName, tagContent);
|
|
80187
80329
|
|
|
80188
|
-
|
|
80330
|
+
this.addChild(currentNode, childNode, jPath)
|
|
80189
80331
|
}else{
|
|
80190
80332
|
//selfClosing tag
|
|
80191
80333
|
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
|
@@ -80202,10 +80344,10 @@ const parseXml = function(xmlData) {
|
|
|
80202
80344
|
|
|
80203
80345
|
const childNode = new xmlNode(tagName);
|
|
80204
80346
|
if(tagName !== tagExp && attrExpPresent){
|
|
80205
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
80347
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
80206
80348
|
}
|
|
80207
80349
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
80208
|
-
|
|
80350
|
+
this.addChild(currentNode, childNode, jPath)
|
|
80209
80351
|
}
|
|
80210
80352
|
//opening tag
|
|
80211
80353
|
else{
|
|
@@ -80213,9 +80355,9 @@ const parseXml = function(xmlData) {
|
|
|
80213
80355
|
this.tagsNodeStack.push(currentNode);
|
|
80214
80356
|
|
|
80215
80357
|
if(tagName !== tagExp && attrExpPresent){
|
|
80216
|
-
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
80358
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
80217
80359
|
}
|
|
80218
|
-
|
|
80360
|
+
this.addChild(currentNode, childNode, jPath)
|
|
80219
80361
|
currentNode = childNode;
|
|
80220
80362
|
}
|
|
80221
80363
|
textData = "";
|
|
@@ -80229,6 +80371,17 @@ const parseXml = function(xmlData) {
|
|
|
80229
80371
|
return xmlObj.child;
|
|
80230
80372
|
}
|
|
80231
80373
|
|
|
80374
|
+
function addChild(currentNode, childNode, jPath){
|
|
80375
|
+
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"])
|
|
80376
|
+
if(result === false){
|
|
80377
|
+
}else if(typeof result === "string"){
|
|
80378
|
+
childNode.tagname = result
|
|
80379
|
+
currentNode.addChild(childNode);
|
|
80380
|
+
}else{
|
|
80381
|
+
currentNode.addChild(childNode);
|
|
80382
|
+
}
|
|
80383
|
+
}
|
|
80384
|
+
|
|
80232
80385
|
const replaceEntitiesValue = function(val){
|
|
80233
80386
|
|
|
80234
80387
|
if(this.options.processEntities){
|
|
@@ -80285,7 +80438,7 @@ function isItStopNode(stopNodes, jPath, currentTagName){
|
|
|
80285
80438
|
}
|
|
80286
80439
|
|
|
80287
80440
|
/**
|
|
80288
|
-
* Returns the tag Expression and where it is ending handling single-
|
|
80441
|
+
* Returns the tag Expression and where it is ending handling single-double quotes situation
|
|
80289
80442
|
* @param {string} xmlData
|
|
80290
80443
|
* @param {number} i starting index
|
|
80291
80444
|
* @returns
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.17",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abap_transpile": "./abap_transpile"
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"author": "abaplint",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@abaplint/transpiler": "^2.6.
|
|
28
|
+
"@abaplint/transpiler": "^2.6.17",
|
|
29
29
|
"@types/glob": "^7.2.0",
|
|
30
30
|
"glob": "=7.2.0",
|
|
31
31
|
"@types/progress": "^2.0.5",
|
|
32
32
|
"@types/node": "^18.15.11",
|
|
33
|
-
"@abaplint/core": "^2.97.
|
|
33
|
+
"@abaplint/core": "^2.97.12",
|
|
34
34
|
"progress": "^2.0.3",
|
|
35
|
-
"webpack": "^5.
|
|
35
|
+
"webpack": "^5.79.0",
|
|
36
36
|
"webpack-cli": "^5.0.1",
|
|
37
37
|
"typescript": "^5.0.4"
|
|
38
38
|
}
|