@abaplint/core 2.112.13 → 2.112.15

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.
@@ -2515,6 +2515,35 @@ declare class FloatType extends AbstractType {
2515
2515
  toCDS(): string;
2516
2516
  }
2517
2517
 
2518
+ export declare class FlowGraph {
2519
+ private edges;
2520
+ private readonly startNode;
2521
+ private readonly endNode;
2522
+ private label;
2523
+ constructor(counter: number);
2524
+ getStart(): string;
2525
+ getEnd(): string;
2526
+ addEdge(from: string, to: string): void;
2527
+ removeEdge(from: string, to: string): void;
2528
+ listEdges(): {
2529
+ from: string;
2530
+ to: string;
2531
+ }[];
2532
+ listInto(to: string, skipStart?: boolean): string[];
2533
+ listNodes(): string[];
2534
+ hasEdges(): boolean;
2535
+ /** return value: end node of to graph */
2536
+ addGraph(from: string, to: FlowGraph): string;
2537
+ toJSON(): string;
2538
+ toTextEdges(): string;
2539
+ setLabel(label: string): void;
2540
+ toDigraph(): string;
2541
+ listSources(node: string): string[];
2542
+ listTargets(node: string): string[];
2543
+ /** removes all nodes containing "#" that have one in-going and one out-going edge */
2544
+ reduce(): this;
2545
+ }
2546
+
2518
2547
  declare class For extends Expression {
2519
2548
  getRunnable(): IStatementRunnable;
2520
2549
  }
@@ -6003,6 +6032,15 @@ declare class StartOfSelection implements IStatement {
6003
6032
  getMatcher(): IStatementRunnable;
6004
6033
  }
6005
6034
 
6035
+ export declare class StatementFlow {
6036
+ private counter;
6037
+ build(stru: StructureNode): FlowGraph[];
6038
+ private findBody;
6039
+ private buildName;
6040
+ private traverseBody;
6041
+ private traverseStructure;
6042
+ }
6043
+
6006
6044
  declare class StatementNode extends AbstractNode<ExpressionNode | TokenNode> {
6007
6045
  private readonly statement;
6008
6046
  private readonly colon;
@@ -113,7 +113,7 @@ class CurrentScope {
113
113
  }
114
114
  const upper = name.toUpperCase();
115
115
  if (this.current.getData().vars[upper] !== undefined) {
116
- // console.dir(new Error().stack);
116
+ // console.dir(new Error().stack);
117
117
  throw new Error(`Variable name "${name}" already defined`);
118
118
  }
119
119
  else if (this.isOO() && this.current.getData().types[upper] !== undefined) {
@@ -131,6 +131,7 @@ class CurrentScope {
131
131
  }
132
132
  const upper = name.toUpperCase();
133
133
  if (parent.getData().vars[upper] !== undefined) {
134
+ // console.dir(new Error().stack);
134
135
  throw new Error(`Variable name "${name}" already defined`);
135
136
  }
136
137
  else if (this.isOO() && parent.getData().types[upper] !== undefined) {
@@ -153,7 +153,7 @@ class ObjectOriented {
153
153
  }
154
154
  if (name.includes("~")) {
155
155
  const interfaceName = upper.split("~")[0];
156
- if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName)) {
156
+ if (this.listInterfacesRecursive(def).includes(interfaceName)) {
157
157
  return this.searchAttributeName(this.scope.findInterfaceDefinition(interfaceName), name.split("~")[1]);
158
158
  }
159
159
  }
@@ -315,7 +315,19 @@ class ObjectOriented {
315
315
  }
316
316
  return ignore;
317
317
  }
318
- // returns list of interfaces implemented
318
+ /** returns list of interfaces implemented, recursive */
319
+ listInterfacesRecursive(definition) {
320
+ const list = [];
321
+ for (const i of definition.getImplementing()) {
322
+ const upper = i.name.toUpperCase();
323
+ list.push(upper);
324
+ const def = this.scope.findInterfaceDefinition(upper);
325
+ if (def) {
326
+ list.push(...this.listInterfacesRecursive(def));
327
+ }
328
+ }
329
+ return [...new Set(list)];
330
+ }
319
331
  fromInterfaces(definition, skip) {
320
332
  const ignore = [];
321
333
  for (const i of definition.getImplementing()) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
4
- exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = void 0;
3
+ exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.FlowGraph = exports.StatementFlow = exports.NativeSQL = exports.MacroContent = exports.MacroCall = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
4
+ exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = void 0;
5
5
  const issue_1 = require("./issue");
6
6
  Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
7
7
  const config_1 = require("./config");
@@ -109,4 +109,8 @@ const diagnostics_1 = require("./lsp/diagnostics");
109
109
  Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return diagnostics_1.Diagnostics; } });
110
110
  const _edit_1 = require("./lsp/_edit");
111
111
  Object.defineProperty(exports, "LSPEdit", { enumerable: true, get: function () { return _edit_1.LSPEdit; } });
112
+ const statement_flow_1 = require("./abap/flow/statement_flow");
113
+ Object.defineProperty(exports, "StatementFlow", { enumerable: true, get: function () { return statement_flow_1.StatementFlow; } });
114
+ const flow_graph_1 = require("./abap/flow/flow_graph");
115
+ Object.defineProperty(exports, "FlowGraph", { enumerable: true, get: function () { return flow_graph_1.FlowGraph; } });
112
116
  //# sourceMappingURL=index.js.map
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.112.13";
70
+ return "2.112.15";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.112.13",
3
+ "version": "2.112.15",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",