@abaplint/transpiler-cli 2.14.39 → 2.14.40
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 +404 -60
- package/package.json +3 -3
package/build/bundle.js
CHANGED
|
@@ -69535,6 +69535,12 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
69535
69535
|
this.parse();
|
|
69536
69536
|
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.description;
|
|
69537
69537
|
}
|
|
69538
|
+
/** SOURCE_TYPE from the abapGit XML, eg. "W" view entity, "P" projection view, "V" DDIC-based view */
|
|
69539
|
+
getSourceType() {
|
|
69540
|
+
var _a;
|
|
69541
|
+
this.parse();
|
|
69542
|
+
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.sourceType;
|
|
69543
|
+
}
|
|
69538
69544
|
parseType(reg) {
|
|
69539
69545
|
this.parse();
|
|
69540
69546
|
if (this.typeCache === undefined || this.typeCacheData !== this.parsedData) {
|
|
@@ -69576,15 +69582,17 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
69576
69582
|
return ret;
|
|
69577
69583
|
}
|
|
69578
69584
|
parse() {
|
|
69579
|
-
var _a, _b;
|
|
69585
|
+
var _a, _b, _c, _d, _e, _f;
|
|
69580
69586
|
if (this.isDirty() === false) {
|
|
69581
69587
|
return { updated: false, runtime: 0 };
|
|
69582
69588
|
}
|
|
69583
69589
|
const start = Date.now();
|
|
69590
|
+
const ddls = (_d = (_c = (_b = (_a = this.parseRaw2()) === null || _a === void 0 ? void 0 : _a.abapGit) === null || _b === void 0 ? void 0 : _b["asx:abap"]) === null || _c === void 0 ? void 0 : _c["asx:values"]) === null || _d === void 0 ? void 0 : _d.DDLS;
|
|
69584
69591
|
this.parsedData = {
|
|
69585
69592
|
sqlViewName: undefined,
|
|
69586
69593
|
definitionName: undefined,
|
|
69587
|
-
|
|
69594
|
+
sourceType: typeof (ddls === null || ddls === void 0 ? void 0 : ddls.SOURCE_TYPE) === "string" ? ddls.SOURCE_TYPE.trim() : undefined,
|
|
69595
|
+
description: undefined,
|
|
69588
69596
|
fields: [],
|
|
69589
69597
|
sources: [],
|
|
69590
69598
|
relations: [],
|
|
@@ -69592,14 +69600,16 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
69592
69600
|
tree: undefined,
|
|
69593
69601
|
};
|
|
69594
69602
|
this.parsedData.tree = new cds_parser_1.CDSParser().parse(this.findSourceFile());
|
|
69595
|
-
this.
|
|
69603
|
+
const leadingAnnotations = this.findLeadingAnnotations(this.parsedData.tree);
|
|
69604
|
+
this.findSQLViewName(leadingAnnotations);
|
|
69605
|
+
this.parsedData.description = this.findDescription(leadingAnnotations, ddls === null || ddls === void 0 ? void 0 : ddls.DDTEXT);
|
|
69596
69606
|
if (this.parsedData.tree) {
|
|
69597
|
-
for (const c of ((
|
|
69607
|
+
for (const c of ((_e = this.parsedData.tree) === null || _e === void 0 ? void 0 : _e.getChildren()) || []) {
|
|
69598
69608
|
if (c.get() instanceof expressions_1.CDSAnnotation) {
|
|
69599
69609
|
continue;
|
|
69600
69610
|
}
|
|
69601
69611
|
if (c instanceof nodes_1.ExpressionNode) {
|
|
69602
|
-
this.parsedData.definitionName = (
|
|
69612
|
+
this.parsedData.definitionName = (_f = c.findFirstExpression(expressions_1.CDSName)) === null || _f === void 0 ? void 0 : _f.concatTokens().replace(/ /g, "");
|
|
69603
69613
|
break;
|
|
69604
69614
|
}
|
|
69605
69615
|
}
|
|
@@ -69617,39 +69627,51 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
69617
69627
|
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.tree;
|
|
69618
69628
|
}
|
|
69619
69629
|
//////////
|
|
69620
|
-
|
|
69630
|
+
/** annotations before the entity definition, ie. not the ones on elements or parameters */
|
|
69631
|
+
findLeadingAnnotations(tree) {
|
|
69621
69632
|
var _a;
|
|
69622
|
-
|
|
69623
|
-
|
|
69624
|
-
const file = this.findSourceFile();
|
|
69625
|
-
if (file === undefined) {
|
|
69626
|
-
return;
|
|
69627
|
-
}
|
|
69628
|
-
// Keep SQL view lookup available even when the view body cannot be parsed.
|
|
69629
|
-
const tokens = cds_lexer_1.CDSLexer.run(file).filter(t => !(t instanceof tokens_1.Comment));
|
|
69630
|
-
const leadingAnnotations = (0, combi_1.seq)((0, combi_1.starPrio)(expressions_1.CDSAnnotation), (0, combi_1.starPrio)((0, combi_1.regex)(/.*/)));
|
|
69631
|
-
annotations = (_a = combi_1.Combi.run(leadingAnnotations, tokens, version_1.defaultRelease)) === null || _a === void 0 ? void 0 : _a.filter((n) => n instanceof nodes_1.ExpressionNode && n.get() instanceof expressions_1.CDSAnnotation);
|
|
69633
|
+
if (tree !== undefined) {
|
|
69634
|
+
return tree.findDirectExpressions(expressions_1.CDSAnnotation);
|
|
69632
69635
|
}
|
|
69633
|
-
|
|
69636
|
+
const file = this.findSourceFile();
|
|
69637
|
+
if (file === undefined) {
|
|
69638
|
+
return [];
|
|
69639
|
+
}
|
|
69640
|
+
// Keep header annotations available even when the definition body cannot be parsed.
|
|
69641
|
+
const tokens = cds_lexer_1.CDSLexer.run(file).filter(t => !(t instanceof tokens_1.Comment));
|
|
69642
|
+
const leadingAnnotations = (0, combi_1.seq)((0, combi_1.starPrio)(expressions_1.CDSAnnotation), (0, combi_1.starPrio)((0, combi_1.regex)(/.*/)));
|
|
69643
|
+
return ((_a = combi_1.Combi.run(leadingAnnotations, tokens, version_1.defaultRelease)) === null || _a === void 0 ? void 0 : _a.filter((n) => n instanceof nodes_1.ExpressionNode && n.get() instanceof expressions_1.CDSAnnotation)) || [];
|
|
69644
|
+
}
|
|
69645
|
+
/** values of the leading annotations with the given name, as written in the source */
|
|
69646
|
+
findLeadingAnnotationValues(annotations, name) {
|
|
69647
|
+
const ret = [];
|
|
69648
|
+
for (const annotation of annotations) {
|
|
69634
69649
|
const tokens = annotation.getTokens().map(t => t.getStr());
|
|
69635
69650
|
const colon = tokens.indexOf(":");
|
|
69636
|
-
if (tokens.slice(0, colon).join("")
|
|
69637
|
-
|
|
69651
|
+
if (colon >= 0 && tokens.slice(0, colon).join("") === name) {
|
|
69652
|
+
ret.push(tokens.slice(colon + 1).join(" "));
|
|
69638
69653
|
}
|
|
69639
|
-
|
|
69654
|
+
}
|
|
69655
|
+
return ret;
|
|
69656
|
+
}
|
|
69657
|
+
findSQLViewName(annotations) {
|
|
69658
|
+
for (const value of this.findLeadingAnnotationValues(annotations, "@AbapCatalog.sqlViewName")) {
|
|
69659
|
+
const match = value.match(/^'([\w/]+)'$/);
|
|
69640
69660
|
if (match) {
|
|
69641
69661
|
this.parsedData.sqlViewName = match[1].toUpperCase();
|
|
69642
69662
|
return;
|
|
69643
69663
|
}
|
|
69644
69664
|
}
|
|
69645
69665
|
}
|
|
69646
|
-
|
|
69647
|
-
|
|
69648
|
-
const
|
|
69649
|
-
|
|
69650
|
-
|
|
69666
|
+
/** entity level EndUserText.label annotation, with fallback to DDTEXT from the abapGit XML */
|
|
69667
|
+
findDescription(annotations, ddtext) {
|
|
69668
|
+
for (const value of this.findLeadingAnnotationValues(annotations, "@EndUserText.label")) {
|
|
69669
|
+
const match = value.match(/^'([\s\S]*)'$/);
|
|
69670
|
+
if (match) {
|
|
69671
|
+
return match[1].replace(/\\(['\\])/g, "$1");
|
|
69672
|
+
}
|
|
69651
69673
|
}
|
|
69652
|
-
return undefined;
|
|
69674
|
+
return typeof ddtext === "string" && ddtext !== "" ? ddtext : undefined;
|
|
69653
69675
|
}
|
|
69654
69676
|
findFieldNames(tree) {
|
|
69655
69677
|
var _a, _b, _c;
|
|
@@ -76916,7 +76938,7 @@ class Registry {
|
|
|
76916
76938
|
}
|
|
76917
76939
|
static abaplintVersion() {
|
|
76918
76940
|
// magic, see build script "version.js"
|
|
76919
|
-
return "2.120.
|
|
76941
|
+
return "2.120.120";
|
|
76920
76942
|
}
|
|
76921
76943
|
getDDICReferences() {
|
|
76922
76944
|
return this.ddicReferences;
|
|
@@ -82823,6 +82845,8 @@ const RESERVED_ELEMENT_NAMES = ["BEGIN", "NUMBER", "POSITION", "ZONE", "HANDLER"
|
|
|
82823
82845
|
const MAX_LABEL_LENGTH = 40;
|
|
82824
82846
|
// Annotations which are not supported in CDS view entities
|
|
82825
82847
|
const VIEW_ENTITY_FORBIDDEN_ANNOTATIONS = ["Semantics.unitOfMeasure", "Semantics.currencyCode"];
|
|
82848
|
+
// Select list elements which are expressions, ie. not plain fields
|
|
82849
|
+
const CALCULATED_ELEMENT = [expressions_1.CDSCast, expressions_1.CDSCase, expressions_1.CDSArithmetics, expressions_1.CDSArithParen, expressions_1.CDSFunction, expressions_1.CDSAggregate, expressions_1.CDSString, expressions_1.CDSInteger];
|
|
82826
82850
|
class CDSCheckSyntax {
|
|
82827
82851
|
constructor() {
|
|
82828
82852
|
this.conf = new CDSCheckSyntaxConf();
|
|
@@ -82834,7 +82858,9 @@ class CDSCheckSyntax {
|
|
|
82834
82858
|
shortDescription: "Checks CDS source, field, type, and semantic annotation references",
|
|
82835
82859
|
extendedInformation: `Performs semantic checks which require other DDIC objects to be available.
|
|
82836
82860
|
|
|
82837
|
-
Missing objects are only reported when their names match the configured errorNamespace
|
|
82861
|
+
Missing objects are only reported when their names match the configured errorNamespace.
|
|
82862
|
+
|
|
82863
|
+
SOURCE_TYPE in the abapGit XML is checked to match the DDL source, W view entity, P projection view, V DDIC-based view.`,
|
|
82838
82864
|
tags: [_irule_1.RuleTag.Syntax],
|
|
82839
82865
|
};
|
|
82840
82866
|
}
|
|
@@ -82846,6 +82872,7 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
82846
82872
|
}
|
|
82847
82873
|
initialize(reg) {
|
|
82848
82874
|
this.reg = reg;
|
|
82875
|
+
this.businessObjectTargets = undefined;
|
|
82849
82876
|
return this;
|
|
82850
82877
|
}
|
|
82851
82878
|
run(object) {
|
|
@@ -82862,13 +82889,17 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
82862
82889
|
const sources = this.findSources(tree, ddic, issues, file);
|
|
82863
82890
|
this.checkRelations(tree, ddic, issues, file);
|
|
82864
82891
|
this.checkTypes(tree, ddic, issues, file);
|
|
82865
|
-
this.checkRootProjection(tree, ddic, issues, file)
|
|
82892
|
+
if (this.checkRootProjection(tree, ddic, issues, file) === false) {
|
|
82893
|
+
this.checkTransactionalProjection(tree, ddic, issues, file);
|
|
82894
|
+
}
|
|
82895
|
+
this.checkCalculatedAssociationPaths(tree, issues, file);
|
|
82866
82896
|
this.checkFieldAnnotations(tree, ddic, issues, file);
|
|
82867
82897
|
this.checkLabels(tree, issues, file);
|
|
82868
82898
|
this.checkViewEntityAnnotations(tree, issues, file);
|
|
82869
82899
|
this.checkSearchable(tree, issues, file);
|
|
82870
82900
|
this.checkReservedNames(tree, issues, file);
|
|
82871
82901
|
this.checkFields(tree, sources, object, issues, file);
|
|
82902
|
+
this.checkSourceType(tree, object, issues);
|
|
82872
82903
|
return issues;
|
|
82873
82904
|
}
|
|
82874
82905
|
findSources(tree, ddic, issues, file) {
|
|
@@ -82923,17 +82954,18 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
82923
82954
|
}
|
|
82924
82955
|
}
|
|
82925
82956
|
}
|
|
82957
|
+
/** returns true if an issue was reported */
|
|
82926
82958
|
checkRootProjection(tree, ddic, issues, file) {
|
|
82927
82959
|
var _a;
|
|
82928
82960
|
const projection = tree.findFirstExpression(expressions_1.CDSDefineProjection);
|
|
82929
82961
|
const rootToken = projection === null || projection === void 0 ? void 0 : projection.findDirectTokenByText("ROOT");
|
|
82930
82962
|
if (projection === undefined || rootToken === undefined) {
|
|
82931
|
-
return;
|
|
82963
|
+
return false;
|
|
82932
82964
|
}
|
|
82933
82965
|
const names = projection.findDirectExpressions(expressions_1.CDSName);
|
|
82934
82966
|
const projectedEntityNode = names[1];
|
|
82935
82967
|
if (projectedEntityNode === undefined) {
|
|
82936
|
-
return;
|
|
82968
|
+
return false;
|
|
82937
82969
|
}
|
|
82938
82970
|
const projectedEntityName = this.name(projectedEntityNode);
|
|
82939
82971
|
const projectedEntity = ddic.lookupTableOrView(projectedEntityName).object;
|
|
@@ -82941,7 +82973,161 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
82941
82973
|
&& ((_a = projectedEntity.getTree()) === null || _a === void 0 ? void 0 : _a.findDirectTokenByText("ROOT")) === undefined) {
|
|
82942
82974
|
const message = `ROOT keyword not valid since ${projectedEntityName} is not a root property`;
|
|
82943
82975
|
issues.push(issue_1.Issue.atToken(file, rootToken, message, this.getMetadata().key, this.conf.severity));
|
|
82976
|
+
return true;
|
|
82944
82977
|
}
|
|
82978
|
+
return false;
|
|
82979
|
+
}
|
|
82980
|
+
/** a transactional projection(no provider contract or TRANSACTIONAL_QUERY) requires a business object entity */
|
|
82981
|
+
checkTransactionalProjection(tree, ddic, issues, file) {
|
|
82982
|
+
const projection = tree.findFirstExpression(expressions_1.CDSDefineProjection);
|
|
82983
|
+
if (projection === undefined || projection.findDirectTokenByText("TRANSIENT") !== undefined) {
|
|
82984
|
+
return;
|
|
82985
|
+
}
|
|
82986
|
+
const contract = projection.findDirectExpression(expressions_1.CDSProviderContract);
|
|
82987
|
+
if (contract !== undefined && contract.findDirectTokenByText("TRANSACTIONAL_QUERY") === undefined) {
|
|
82988
|
+
return;
|
|
82989
|
+
}
|
|
82990
|
+
const projectedEntityNode = projection.findDirectExpressions(expressions_1.CDSName)[1];
|
|
82991
|
+
if (projectedEntityNode === undefined) {
|
|
82992
|
+
return;
|
|
82993
|
+
}
|
|
82994
|
+
const projectedEntityName = this.name(projectedEntityNode);
|
|
82995
|
+
const projectedEntity = ddic.lookupTableOrView(projectedEntityName).object;
|
|
82996
|
+
if (!(projectedEntity instanceof objects_1.DataDefinition)) {
|
|
82997
|
+
return;
|
|
82998
|
+
}
|
|
82999
|
+
const projectedTree = projectedEntity.getTree();
|
|
83000
|
+
// only plain select based views are checked, ie. not projections, abstract or custom entities
|
|
83001
|
+
if (projectedTree === undefined || !(projectedTree.get() instanceof expressions_1.CDSDefineView)) {
|
|
83002
|
+
return;
|
|
83003
|
+
}
|
|
83004
|
+
if (projectedTree.findDirectTokenByText("ROOT") !== undefined
|
|
83005
|
+
|| projectedTree.findAllExpressionsRecursive(expressions_1.CDSComposition).length > 0
|
|
83006
|
+
|| projectedTree.findAllExpressionsRecursive(expressions_1.CDSAssociation).some(a => a.findDirectTokenByText("PARENT") !== undefined)) {
|
|
83007
|
+
return;
|
|
83008
|
+
}
|
|
83009
|
+
const candidates = [projectedEntityName.toUpperCase(), projectedEntity.getName().toUpperCase()];
|
|
83010
|
+
const definitionName = projectedEntity.getDefinitionName();
|
|
83011
|
+
if (definitionName !== undefined) {
|
|
83012
|
+
candidates.push(definitionName.toUpperCase());
|
|
83013
|
+
}
|
|
83014
|
+
const targets = this.findBusinessObjectTargets();
|
|
83015
|
+
if (candidates.some(c => targets.has(c))) {
|
|
83016
|
+
return;
|
|
83017
|
+
}
|
|
83018
|
+
const message = `Transactional projection on ${projectedEntityName} not possible, ` +
|
|
83019
|
+
`${projectedEntityName} is not a root entity or part of a composition`;
|
|
83020
|
+
issues.push(issue_1.Issue.atToken(file, projectedEntityNode.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
83021
|
+
}
|
|
83022
|
+
/** names of entities targeted by a composition or an association to parent in any DDLS in the registry */
|
|
83023
|
+
findBusinessObjectTargets() {
|
|
83024
|
+
if (this.businessObjectTargets !== undefined) {
|
|
83025
|
+
return this.businessObjectTargets;
|
|
83026
|
+
}
|
|
83027
|
+
const targets = new Set();
|
|
83028
|
+
for (const obj of this.reg.getObjectsByType("DDLS")) {
|
|
83029
|
+
const tree = obj.getTree();
|
|
83030
|
+
if (tree === undefined) {
|
|
83031
|
+
continue;
|
|
83032
|
+
}
|
|
83033
|
+
const relations = [];
|
|
83034
|
+
for (const composition of tree.findAllExpressionsRecursive(expressions_1.CDSComposition)) {
|
|
83035
|
+
const relation = composition.findDirectExpression(expressions_1.CDSRelation);
|
|
83036
|
+
if (relation) {
|
|
83037
|
+
relations.push(relation);
|
|
83038
|
+
}
|
|
83039
|
+
}
|
|
83040
|
+
for (const association of tree.findAllExpressionsRecursive(expressions_1.CDSAssociation)) {
|
|
83041
|
+
const relation = association.findDirectExpression(expressions_1.CDSRelation);
|
|
83042
|
+
if (relation && association.findDirectTokenByText("PARENT") !== undefined) {
|
|
83043
|
+
relations.push(relation);
|
|
83044
|
+
}
|
|
83045
|
+
}
|
|
83046
|
+
for (const relation of relations) {
|
|
83047
|
+
const name = relation.getDirectTokens().map(t => t.getStr()).join("");
|
|
83048
|
+
if (name !== "") {
|
|
83049
|
+
targets.add(name.toUpperCase());
|
|
83050
|
+
}
|
|
83051
|
+
}
|
|
83052
|
+
}
|
|
83053
|
+
this.businessObjectTargets = targets;
|
|
83054
|
+
return targets;
|
|
83055
|
+
}
|
|
83056
|
+
/** path expressions are not possible via an association whose ON condition uses a calculated element */
|
|
83057
|
+
checkCalculatedAssociationPaths(tree, issues, file) {
|
|
83058
|
+
var _a, _b;
|
|
83059
|
+
for (const select of tree.findAllExpressionsRecursive(expressions_1.CDSSelect)) {
|
|
83060
|
+
const elements = select.findDirectExpressions(expressions_1.CDSElement);
|
|
83061
|
+
const calculated = new Map();
|
|
83062
|
+
for (const element of elements) {
|
|
83063
|
+
const name = (_a = element.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
|
|
83064
|
+
if (name !== undefined && element.findDirectExpressionsMulti(CALCULATED_ELEMENT).length > 0) {
|
|
83065
|
+
calculated.set(this.name(name).toUpperCase(), this.name(name));
|
|
83066
|
+
}
|
|
83067
|
+
}
|
|
83068
|
+
if (calculated.size === 0) {
|
|
83069
|
+
continue;
|
|
83070
|
+
}
|
|
83071
|
+
const marked = new Map();
|
|
83072
|
+
for (const association of select.findDirectExpressions(expressions_1.CDSAssociation)) {
|
|
83073
|
+
const relation = association.findDirectExpression(expressions_1.CDSRelation);
|
|
83074
|
+
const condition = association.findDirectExpression(expressions_1.CDSCondition);
|
|
83075
|
+
if (relation === undefined || condition === undefined) {
|
|
83076
|
+
continue;
|
|
83077
|
+
}
|
|
83078
|
+
const aliasNode = (_b = relation.findDirectExpression(expressions_1.CDSAs)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(expressions_1.CDSName);
|
|
83079
|
+
const alias = aliasNode ? this.name(aliasNode) : relation.getDirectTokens().map(t => t.getStr()).join("");
|
|
83080
|
+
for (const prefixed of condition.findAllExpressionsRecursive(expressions_1.CDSPrefixedName)) {
|
|
83081
|
+
const names = prefixed.findDirectExpressions(expressions_1.CDSName);
|
|
83082
|
+
if (names.length !== 2 || this.name(names[0]).toUpperCase() !== "$PROJECTION") {
|
|
83083
|
+
continue;
|
|
83084
|
+
}
|
|
83085
|
+
const element = calculated.get(this.name(names[1]).toUpperCase());
|
|
83086
|
+
if (element !== undefined && marked.has(alias.toUpperCase()) === false) {
|
|
83087
|
+
marked.set(alias.toUpperCase(), element);
|
|
83088
|
+
}
|
|
83089
|
+
}
|
|
83090
|
+
}
|
|
83091
|
+
if (marked.size === 0) {
|
|
83092
|
+
continue;
|
|
83093
|
+
}
|
|
83094
|
+
const usages = [...elements];
|
|
83095
|
+
for (const clause of select.findDirectExpressionsMulti([expressions_1.CDSWhere, expressions_1.CDSGroupBy, expressions_1.CDSHaving])) {
|
|
83096
|
+
usages.push(clause);
|
|
83097
|
+
}
|
|
83098
|
+
for (const usage of usages) {
|
|
83099
|
+
for (const prefixed of this.findPrefixedNames(usage)) {
|
|
83100
|
+
const names = prefixed.findDirectExpressions(expressions_1.CDSName);
|
|
83101
|
+
if (names.length < 2) {
|
|
83102
|
+
continue;
|
|
83103
|
+
}
|
|
83104
|
+
const alias = this.name(names[0]);
|
|
83105
|
+
const element = marked.get(alias.toUpperCase());
|
|
83106
|
+
if (element === undefined) {
|
|
83107
|
+
continue;
|
|
83108
|
+
}
|
|
83109
|
+
const message = `Path expression via ${alias} not possible, ` +
|
|
83110
|
+
`its ON condition uses calculated element ${element}`;
|
|
83111
|
+
issues.push(issue_1.Issue.atToken(file, names[0].getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
83112
|
+
}
|
|
83113
|
+
}
|
|
83114
|
+
}
|
|
83115
|
+
}
|
|
83116
|
+
/** outermost prefixed names, skipping annotations */
|
|
83117
|
+
findPrefixedNames(node) {
|
|
83118
|
+
const ret = [];
|
|
83119
|
+
for (const child of node.getChildren()) {
|
|
83120
|
+
if (!(child instanceof nodes_1.ExpressionNode) || child.get() instanceof expressions_1.CDSAnnotation) {
|
|
83121
|
+
continue;
|
|
83122
|
+
}
|
|
83123
|
+
else if (child.get() instanceof expressions_1.CDSPrefixedName) {
|
|
83124
|
+
ret.push(child);
|
|
83125
|
+
}
|
|
83126
|
+
else {
|
|
83127
|
+
ret.push(...this.findPrefixedNames(child));
|
|
83128
|
+
}
|
|
83129
|
+
}
|
|
83130
|
+
return ret;
|
|
82945
83131
|
}
|
|
82946
83132
|
checkFieldAnnotations(tree, ddic, issues, file) {
|
|
82947
83133
|
const definition = tree.findFirstExpression(expressions_1.CDSDefineAbstract);
|
|
@@ -83131,8 +83317,37 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
83131
83317
|
}
|
|
83132
83318
|
}
|
|
83133
83319
|
}
|
|
83320
|
+
/** SOURCE_TYPE in the XML must match the DDL source, only the confirmed W/P/V mappings are checked */
|
|
83321
|
+
checkSourceType(tree, object, issues) {
|
|
83322
|
+
const sourceType = object.getSourceType();
|
|
83323
|
+
const xmlFile = object.getXMLFile();
|
|
83324
|
+
if (sourceType === undefined || xmlFile === undefined || ["W", "P", "V"].includes(sourceType) === false) {
|
|
83325
|
+
return;
|
|
83326
|
+
}
|
|
83327
|
+
// other definitions(abstract, custom, table functions, etc.) are skipped
|
|
83328
|
+
let expected = undefined;
|
|
83329
|
+
if (tree.get() instanceof expressions_1.CDSDefineView && tree.findDirectTokenByText("WRITABLE") === undefined) {
|
|
83330
|
+
if (tree.findDirectTokenByText("ENTITY") !== undefined) {
|
|
83331
|
+
expected = "W";
|
|
83332
|
+
}
|
|
83333
|
+
else if (object.getSQLViewName() !== undefined) {
|
|
83334
|
+
expected = "V";
|
|
83335
|
+
}
|
|
83336
|
+
}
|
|
83337
|
+
else if (tree.get() instanceof expressions_1.CDSDefineProjection && tree.findDirectTokenByText("ENTITY") !== undefined) {
|
|
83338
|
+
expected = "P";
|
|
83339
|
+
}
|
|
83340
|
+
if (expected === undefined || expected === sourceType) {
|
|
83341
|
+
return;
|
|
83342
|
+
}
|
|
83343
|
+
const xml = xmlFile.getRaw();
|
|
83344
|
+
const index = xml.indexOf("<SOURCE_TYPE>");
|
|
83345
|
+
const row = index < 0 ? 1 : xml.substring(0, index).split("\n").length;
|
|
83346
|
+
const message = `SOURCE_TYPE "${sourceType}" does not match DDL source, expected "${expected}"`;
|
|
83347
|
+
issues.push(issue_1.Issue.atRow(xmlFile, row, message, this.getMetadata().key, this.conf.severity));
|
|
83348
|
+
}
|
|
83134
83349
|
checkFields(tree, sources, object, issues, file) {
|
|
83135
|
-
var _a;
|
|
83350
|
+
var _a, _b;
|
|
83136
83351
|
const associationNames = new Set();
|
|
83137
83352
|
for (const association of ((_a = object.getParsedData()) === null || _a === void 0 ? void 0 : _a.associations) || []) {
|
|
83138
83353
|
associationNames.add(association.name.toUpperCase());
|
|
@@ -83140,6 +83355,21 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
83140
83355
|
associationNames.add(association.as.toUpperCase());
|
|
83141
83356
|
}
|
|
83142
83357
|
}
|
|
83358
|
+
for (const composition of tree.findAllExpressionsRecursive(expressions_1.CDSComposition)) {
|
|
83359
|
+
const relation = composition.findDirectExpression(expressions_1.CDSRelation);
|
|
83360
|
+
if (relation === undefined) {
|
|
83361
|
+
continue;
|
|
83362
|
+
}
|
|
83363
|
+
// direct tokens exclude the alias and parameters, and include a namespace like /ABC/
|
|
83364
|
+
const name = relation.getDirectTokens().map(t => t.getStr()).join("");
|
|
83365
|
+
if (name !== "") {
|
|
83366
|
+
associationNames.add(name.toUpperCase());
|
|
83367
|
+
}
|
|
83368
|
+
const alias = (_b = relation.findDirectExpression(expressions_1.CDSAs)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(expressions_1.CDSName);
|
|
83369
|
+
if (alias) {
|
|
83370
|
+
associationNames.add(this.name(alias).toUpperCase());
|
|
83371
|
+
}
|
|
83372
|
+
}
|
|
83143
83373
|
for (const element of tree.findAllExpressionsRecursive(expressions_1.CDSElement)) {
|
|
83144
83374
|
const prefixed = element.findDirectExpression(expressions_1.CDSPrefixedName);
|
|
83145
83375
|
if (prefixed === undefined) {
|
|
@@ -123193,6 +123423,9 @@ class CDSMetadata {
|
|
|
123193
123423
|
}
|
|
123194
123424
|
}
|
|
123195
123425
|
}
|
|
123426
|
+
else if (def instanceof cds.CDSDefineHierarchy) {
|
|
123427
|
+
this.hierarchy(root, result);
|
|
123428
|
+
}
|
|
123196
123429
|
else {
|
|
123197
123430
|
this.signature(root, result);
|
|
123198
123431
|
}
|
|
@@ -123233,7 +123466,7 @@ class CDSMetadata {
|
|
|
123233
123466
|
// the first name is the projection's own, the second the projected entity
|
|
123234
123467
|
const name = root.findDirectExpressions(cds.CDSName)[1];
|
|
123235
123468
|
if (name) {
|
|
123236
|
-
ret.push(name.concatTokens().toUpperCase());
|
|
123469
|
+
ret.push(name.concatTokens().replace(/ /g, "").toUpperCase());
|
|
123237
123470
|
}
|
|
123238
123471
|
}
|
|
123239
123472
|
for (const s of root.findAllExpressions(cds.CDSSource)) {
|
|
@@ -123322,7 +123555,7 @@ class CDSMetadata {
|
|
|
123322
123555
|
return undefined;
|
|
123323
123556
|
}
|
|
123324
123557
|
const rest = children.slice(to + 1).map(c => c.concatTokens().toUpperCase());
|
|
123325
|
-
const target = children.slice(to + 1).find(c => c.get() instanceof cds.CDSName)?.concatTokens();
|
|
123558
|
+
const target = children.slice(to + 1).find(c => c.get() instanceof cds.CDSName)?.concatTokens().replace(/ /g, "");
|
|
123326
123559
|
if (target === undefined) {
|
|
123327
123560
|
return undefined;
|
|
123328
123561
|
}
|
|
@@ -123335,6 +123568,52 @@ class CDSMetadata {
|
|
|
123335
123568
|
}
|
|
123336
123569
|
return { target, type };
|
|
123337
123570
|
}
|
|
123571
|
+
/** hierarchies list their elements directly under the root, after the "{" and separated by ",":
|
|
123572
|
+
* [annotations] [KEY] path [AS alias]. Associations of the SOURCE entity can be exposed. */
|
|
123573
|
+
hierarchy(root, result) {
|
|
123574
|
+
const children = root.getChildren();
|
|
123575
|
+
const token = (c) => c instanceof abaplint.Nodes.TokenNode ? c.getFirstToken().getStr().toUpperCase() : "";
|
|
123576
|
+
const source = children[children.findIndex(c => token(c) === "SOURCE") + 1];
|
|
123577
|
+
const sources = source?.get() instanceof cds.CDSName ? [source.concatTokens().toUpperCase()] : [];
|
|
123578
|
+
let annotations = [];
|
|
123579
|
+
let key = false;
|
|
123580
|
+
let path = [];
|
|
123581
|
+
let as;
|
|
123582
|
+
for (const child of children.slice(children.findIndex(c => token(c) === "{") + 1)) {
|
|
123583
|
+
const text = token(child);
|
|
123584
|
+
if (child.get() instanceof cds.CDSAnnotation) {
|
|
123585
|
+
annotations.push(CDSMetadata.annotation(child));
|
|
123586
|
+
}
|
|
123587
|
+
else if (text === "KEY") {
|
|
123588
|
+
key = true;
|
|
123589
|
+
}
|
|
123590
|
+
else if (child.get() instanceof cds.CDSPrefixedName) {
|
|
123591
|
+
path = child.findAllExpressions(cds.CDSName).map(n => n.concatTokens());
|
|
123592
|
+
}
|
|
123593
|
+
else if (child.get() instanceof cds.CDSAs) {
|
|
123594
|
+
as = this.alias(child);
|
|
123595
|
+
}
|
|
123596
|
+
else if (text === "," || text === "}") {
|
|
123597
|
+
if (path.length > 0) {
|
|
123598
|
+
const name = as ?? path[path.length - 1];
|
|
123599
|
+
const inherited = this.sourceAssociation(sources, path[path.length - 1]);
|
|
123600
|
+
if (inherited) {
|
|
123601
|
+
result.associations.push({ ...inherited, name, exposed: true, annotations });
|
|
123602
|
+
}
|
|
123603
|
+
else {
|
|
123604
|
+
result.fields.push({ name, key, virtual: false, annotations });
|
|
123605
|
+
}
|
|
123606
|
+
}
|
|
123607
|
+
annotations = [];
|
|
123608
|
+
key = false;
|
|
123609
|
+
path = [];
|
|
123610
|
+
as = undefined;
|
|
123611
|
+
if (text === "}") {
|
|
123612
|
+
return;
|
|
123613
|
+
}
|
|
123614
|
+
}
|
|
123615
|
+
}
|
|
123616
|
+
}
|
|
123338
123617
|
/** abstract and custom entities and table functions list their elements inline: name : type ; */
|
|
123339
123618
|
signature(root, result) {
|
|
123340
123619
|
let inBody = false;
|
|
@@ -125420,7 +125699,8 @@ const constant_1 = __webpack_require__(/*! ./constant */ "./node_modules/@abapli
|
|
|
125420
125699
|
class CallTransformationParametersTranspiler {
|
|
125421
125700
|
transpile(node, traversal) {
|
|
125422
125701
|
if (node.getFirstChild()?.get() instanceof abaplint.Expressions.Dynamic) {
|
|
125423
|
-
|
|
125702
|
+
// a dynamic parameter table named with its body suffix: (lt_x[])
|
|
125703
|
+
return new chunk_1.Chunk().append(node.concatTokens().replace(/\[\]\s*\)$/, ")"), node, traversal);
|
|
125424
125704
|
}
|
|
125425
125705
|
else {
|
|
125426
125706
|
const res = new chunk_1.Chunk().appendString("{");
|
|
@@ -125539,6 +125819,11 @@ class CompareTranspiler {
|
|
|
125539
125819
|
else if (concat.endsWith("IS ASSIGNED")) {
|
|
125540
125820
|
return new chunk_1.Chunk().appendString("abap.compare.assigned(").appendChunk(s0).appendString(")");
|
|
125541
125821
|
}
|
|
125822
|
+
// a table parameter is often named with its body suffix (it_x[] IS
|
|
125823
|
+
// SUPPLIED): the parameter is it_x, "[]" is no part of a JS name
|
|
125824
|
+
if (/ IS (NOT )?(SUPPLIED|REQUESTED)$/.test(concat)) {
|
|
125825
|
+
concat = concat.replace(/\[\](?= IS )/, "");
|
|
125826
|
+
}
|
|
125542
125827
|
if (concat.endsWith(" IS SUPPLIED")) {
|
|
125543
125828
|
if (concat.startsWith("NOT ")) {
|
|
125544
125829
|
concat = concat.replace("NOT ", "");
|
|
@@ -128739,11 +129024,12 @@ const let_1 = __webpack_require__(/*! ./let */ "./node_modules/@abaplint/transpi
|
|
|
128739
129024
|
const value_body_1 = __webpack_require__(/*! ./value_body */ "./node_modules/@abaplint/transpiler/build/src/expressions/value_body.js");
|
|
128740
129025
|
class SourceTranspiler {
|
|
128741
129026
|
addGet;
|
|
128742
|
-
|
|
128743
|
-
/**
|
|
128744
|
-
|
|
129027
|
+
calculation;
|
|
129028
|
+
/** calculation: the calculation type the target gives integer operands, each operation
|
|
129029
|
+
* gets its left operand as an int8, or as a decfloat34 when the target is p, f or decfloat34 */
|
|
129030
|
+
constructor(addGet = false, calculation) {
|
|
128745
129031
|
this.addGet = addGet;
|
|
128746
|
-
this.
|
|
129032
|
+
this.calculation = calculation;
|
|
128747
129033
|
}
|
|
128748
129034
|
// the operands of a chain of & / && (the rearranger leaves them as a binary
|
|
128749
129035
|
// tree of Source nodes); an empty list when the node is not such a chain
|
|
@@ -128811,8 +129097,8 @@ class SourceTranspiler {
|
|
|
128811
129097
|
break;
|
|
128812
129098
|
}
|
|
128813
129099
|
}
|
|
128814
|
-
//
|
|
128815
|
-
let
|
|
129100
|
+
// whether the operand left of the next operator already has the calculation type
|
|
129101
|
+
let leftIsCalculation = false;
|
|
128816
129102
|
for (let i = startIdx; i < children.length; i++) {
|
|
128817
129103
|
const c = children[i];
|
|
128818
129104
|
const isLast = i === children.length - 1;
|
|
@@ -128838,17 +129124,18 @@ class SourceTranspiler {
|
|
|
128838
129124
|
prefixNegated = false;
|
|
128839
129125
|
}
|
|
128840
129126
|
// "/" rounds in calculation type int8, the runtime's divide() does not know the target
|
|
128841
|
-
const operator = this.
|
|
129127
|
+
const operator = this.calculation === "int8" && c.concatTokens().trim() === "/"
|
|
128842
129128
|
? new chunk_1.Chunk().append("abap.operators.divideInt8", c, traversal)
|
|
128843
129129
|
: traversal.traverse(c);
|
|
128844
|
-
if (this.
|
|
128845
|
-
|
|
129130
|
+
if (this.calculation !== undefined && leftIsCalculation === false) {
|
|
129131
|
+
const type = this.calculation === "int8" ? "Integer8" : "DecFloat34";
|
|
129132
|
+
ret = new chunk_1.Chunk().appendChunk(operator).appendString(`(new abap.types.${type}().set(`).appendChunk(ret).appendString("),");
|
|
128846
129133
|
}
|
|
128847
129134
|
else {
|
|
128848
129135
|
ret = new chunk_1.Chunk().appendChunk(operator).appendString("(").appendChunk(ret).appendString(",");
|
|
128849
129136
|
}
|
|
128850
|
-
// the result of an operation with an int8 operand
|
|
128851
|
-
|
|
129137
|
+
// the result of an operation with an int8 or decfloat34 operand has that type
|
|
129138
|
+
leftIsCalculation = true;
|
|
128852
129139
|
post.appendString(")");
|
|
128853
129140
|
if (this.addGet) {
|
|
128854
129141
|
post.append(".get()", c, traversal);
|
|
@@ -128865,8 +129152,8 @@ class SourceTranspiler {
|
|
|
128865
129152
|
}
|
|
128866
129153
|
}
|
|
128867
129154
|
else if (c.get() instanceof core_1.Expressions.Source) {
|
|
128868
|
-
ret.appendChunk(new SourceTranspiler(this.addGet, this.
|
|
128869
|
-
|
|
129155
|
+
ret.appendChunk(new SourceTranspiler(this.addGet, this.calculation).transpile(c, traversal));
|
|
129156
|
+
leftIsCalculation = c.findDirectExpression(core_1.Expressions.ArithOperator) !== undefined;
|
|
128870
129157
|
}
|
|
128871
129158
|
else if (c.get() instanceof core_1.Expressions.Arrow) {
|
|
128872
129159
|
ret = new chunk_1.Chunk().appendString("(").appendChunk(ret).appendString(").get().");
|
|
@@ -131790,7 +132077,8 @@ class HandleABAP {
|
|
|
131790
132077
|
output.chunk.runIndentationLogic(this.options?.ignoreSourceMap);
|
|
131791
132078
|
}
|
|
131792
132079
|
if (this.options?.addCommonJS === true) {
|
|
131793
|
-
|
|
132080
|
+
const owner = this.findOwnerRequiredByLocals(obj, ret);
|
|
132081
|
+
ret.map(output => output.chunk = this.addImportsAndExports(output, owner));
|
|
131794
132082
|
}
|
|
131795
132083
|
return ret;
|
|
131796
132084
|
}
|
|
@@ -131844,8 +132132,33 @@ class HandleABAP {
|
|
|
131844
132132
|
}
|
|
131845
132133
|
return ret;
|
|
131846
132134
|
}
|
|
131847
|
-
|
|
132135
|
+
/** A local class inheriting from its own global class: the locals module needs the owner
|
|
132136
|
+
* defined, and the owner module awaits the locals before it is defined. Under top-level await
|
|
132137
|
+
* that import cycle never settles. When the locals require the owner, the locals take it from
|
|
132138
|
+
* abap.Classes and the owner imports its locals right after registering itself, still before its
|
|
132139
|
+
* static values and class constructors, which may use the locals */
|
|
132140
|
+
findOwnerRequiredByLocals(obj, output) {
|
|
132141
|
+
if (!(obj instanceof abaplint.Objects.Class)) {
|
|
132142
|
+
return undefined;
|
|
132143
|
+
}
|
|
132144
|
+
const main = obj.getMainABAPFile()?.getFilename().replace(".abap", ".mjs").toLowerCase();
|
|
132145
|
+
const locals = output.find(o => o.filename.endsWith(".clas.locals.mjs"));
|
|
132146
|
+
if (main === undefined || locals === undefined
|
|
132147
|
+
|| locals.requires.some(r => r.filename.replace(".abap", ".mjs").toLowerCase() === main) === false) {
|
|
132148
|
+
return undefined;
|
|
132149
|
+
}
|
|
132150
|
+
const name = obj.getName();
|
|
132151
|
+
return {
|
|
132152
|
+
main: main,
|
|
132153
|
+
locals: locals.filename,
|
|
132154
|
+
registration: "abap.Classes['" + name.toUpperCase() + "'] = " + traversal_1.Traversal.escapeNamespace(name.toLowerCase()) + ";",
|
|
132155
|
+
lookup: "abap.Classes['" + name.toUpperCase() + "']",
|
|
132156
|
+
};
|
|
132157
|
+
}
|
|
132158
|
+
addImportsAndExports(output, deferred) {
|
|
131848
132159
|
const contents = new chunk_1.Chunk();
|
|
132160
|
+
const isMain = deferred !== undefined && output.filename === deferred.main;
|
|
132161
|
+
const isLocals = deferred !== undefined && output.filename === deferred.locals;
|
|
131849
132162
|
for (const r of output.requires) {
|
|
131850
132163
|
const name = r.name?.toLowerCase();
|
|
131851
132164
|
const filename = r.filename.replace(".abap", ".mjs");
|
|
@@ -131853,6 +132166,18 @@ class HandleABAP {
|
|
|
131853
132166
|
continue;
|
|
131854
132167
|
}
|
|
131855
132168
|
const specifier = (0, output_layout_1.importPath)(this.layout.file(output.object, output.filename), this.layout.sourceModule(r.filename));
|
|
132169
|
+
if (isMain && filename.toLowerCase() === deferred.locals) {
|
|
132170
|
+
const occurrences = output.chunk.getCode().split(deferred.registration).length - 1;
|
|
132171
|
+
if (occurrences !== 1) {
|
|
132172
|
+
throw new Error("HandleABAP, class registration not found once in " + output.filename + ", cannot defer its locals");
|
|
132173
|
+
}
|
|
132174
|
+
output.chunk.replaceAll(deferred.registration, deferred.registration + "\nawait import(\"" + specifier + "\");");
|
|
132175
|
+
continue;
|
|
132176
|
+
}
|
|
132177
|
+
else if (isLocals && filename.toLowerCase() === deferred.main && name) {
|
|
132178
|
+
contents.appendString("const " + traversal_1.Traversal.escapeNamespace(name) + " = " + deferred.lookup + ";\n");
|
|
132179
|
+
continue;
|
|
132180
|
+
}
|
|
131856
132181
|
if (name) {
|
|
131857
132182
|
contents.appendString("const {" + traversal_1.Traversal.escapeNamespace(name) + "} = await import(\"" + specifier + "\");\n");
|
|
131858
132183
|
}
|
|
@@ -142025,8 +142350,9 @@ class MoveTranspiler {
|
|
|
142025
142350
|
? this.correspondingGeneric(sourceExpression, targets[0], traversal)
|
|
142026
142351
|
: undefined;
|
|
142027
142352
|
if (source === undefined) {
|
|
142028
|
-
|
|
142029
|
-
|
|
142353
|
+
const calculation = this.integerCalculation(node, sourceExpression, targetExpressions.length, traversal);
|
|
142354
|
+
source = calculation !== undefined
|
|
142355
|
+
? new source_1.SourceTranspiler(false, calculation).transpile(sourceExpression, traversal)
|
|
142030
142356
|
: traversal.traverse(sourceExpression);
|
|
142031
142357
|
}
|
|
142032
142358
|
switch (second) {
|
|
@@ -142111,20 +142437,35 @@ class MoveTranspiler {
|
|
|
142111
142437
|
// when the target or an operand is int8: i * i into int8 is exact up to 2^62, and "/"
|
|
142112
142438
|
// rounds. The runtime decides by the operands alone and does not know the target, so here
|
|
142113
142439
|
// the operands are converted to int8 before the calculation. Only for an i or int8 target
|
|
142114
|
-
// and operands whose type is known to be i or int8, and not for **, which counts as f
|
|
142115
|
-
|
|
142440
|
+
// and operands whose type is known to be i or int8, and not for **, which counts as f.
|
|
142441
|
+
// With a p, f or decfloat34 target the calculation type is that of the target, and an int8
|
|
142442
|
+
// result outside the int8 range is no overflow: the operands are converted to decfloat34,
|
|
142443
|
+
// exact for sums, differences and products of int8, so the runtime does not raise for them
|
|
142444
|
+
integerCalculation(node, source, targets, traversal) {
|
|
142116
142445
|
if (source === undefined
|
|
142117
142446
|
|| targets !== 1
|
|
142118
142447
|
|| source.findFirstExpression(abaplint.Expressions.ArithOperator) === undefined) {
|
|
142119
|
-
return
|
|
142448
|
+
return undefined;
|
|
142120
142449
|
}
|
|
142121
142450
|
const scope = traversal.findCurrentScopeByToken(node.getFirstToken());
|
|
142122
142451
|
const target = traversal.determineType(node, scope);
|
|
142452
|
+
const wide = target instanceof abaplint.BasicTypes.PackedType
|
|
142453
|
+
|| target instanceof abaplint.BasicTypes.FloatType
|
|
142454
|
+
|| target instanceof abaplint.BasicTypes.DecFloat34Type;
|
|
142123
142455
|
const found = { int8: target instanceof abaplint.BasicTypes.Integer8Type };
|
|
142124
|
-
if (found.int8 === false && !(target instanceof abaplint.BasicTypes.IntegerType)) {
|
|
142125
|
-
return
|
|
142456
|
+
if (found.int8 === false && wide === false && !(target instanceof abaplint.BasicTypes.IntegerType)) {
|
|
142457
|
+
return undefined;
|
|
142458
|
+
}
|
|
142459
|
+
else if (this.integerOperands(source, scope, found) === false || found.int8 === false) {
|
|
142460
|
+
return undefined;
|
|
142126
142461
|
}
|
|
142127
|
-
|
|
142462
|
+
else if (wide === true) {
|
|
142463
|
+
// DIV and MOD of a decfloat34 go through a double in the runtime, they stay int8
|
|
142464
|
+
const divMod = source.findAllExpressions(abaplint.Expressions.ArithOperator)
|
|
142465
|
+
.some(o => ["DIV", "MOD"].includes(o.concatTokens().toUpperCase()));
|
|
142466
|
+
return divMod ? undefined : "decfloat34";
|
|
142467
|
+
}
|
|
142468
|
+
return "int8";
|
|
142128
142469
|
}
|
|
142129
142470
|
integerOperands(node, scope, found) {
|
|
142130
142471
|
for (const c of node.getChildren()) {
|
|
@@ -144548,9 +144889,12 @@ abap.builtin.sy.get().dbcnt.set(${target}.getArrayLength());
|
|
|
144548
144889
|
+ ` : ${code}.get())`;
|
|
144549
144890
|
}
|
|
144550
144891
|
dynamicSQLClause(keyword, code) {
|
|
144892
|
+
// a dynamic ORDER BY may separate its columns with blanks, as Open SQL
|
|
144893
|
+
// allows; abap.dynamicOrderBy puts the commas SQL needs between them
|
|
144894
|
+
const list = (text) => keyword === "ORDER BY" ? `abap.dynamicOrderBy(${text})` : text;
|
|
144551
144895
|
return `(${code} instanceof abap.types.Table || ${code} instanceof abap.types.HashedTable`
|
|
144552
|
-
+ ` ? (${code}.array().length === 0 ? "" : "${keyword} " + ${code}.array().map(row => row.get()).join(", "))`
|
|
144553
|
-
+ ` : (("" + ${code}.get()).trim() === "" ? "" : "${keyword} " + ${code}.get()))`;
|
|
144896
|
+
+ ` ? (${code}.array().length === 0 ? "" : "${keyword} " + ${list(`${code}.array().map(row => row.get()).join(", ")`)})`
|
|
144897
|
+
+ ` : (("" + ${code}.get()).trim() === "" ? "" : "${keyword} " + ${list(`${code}.get()`)}))`;
|
|
144554
144898
|
}
|
|
144555
144899
|
dynamicHavingClause(code) {
|
|
144556
144900
|
return `((value) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.40",
|
|
4
4
|
"description": "Transpiler - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"author": "abaplint",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@abaplint/core": "^2.120.
|
|
31
|
-
"@abaplint/transpiler": "^2.14.
|
|
30
|
+
"@abaplint/core": "^2.120.120",
|
|
31
|
+
"@abaplint/transpiler": "^2.14.40",
|
|
32
32
|
"@types/glob": "^9.0.0",
|
|
33
33
|
"@types/node": "^26.6.6",
|
|
34
34
|
"@types/progress": "^2.0.7",
|