@abaplint/core 2.112.14 → 2.112.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.
@@ -2515,6 +2515,36 @@ 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
+ getLabel(): string;
2526
+ getEnd(): string;
2527
+ addEdge(from: string, to: string): void;
2528
+ removeEdge(from: string, to: string): void;
2529
+ listEdges(): {
2530
+ from: string;
2531
+ to: string;
2532
+ }[];
2533
+ listInto(to: string, skipStart?: boolean): string[];
2534
+ listNodes(): string[];
2535
+ hasEdges(): boolean;
2536
+ /** return value: end node of to graph */
2537
+ addGraph(from: string, to: FlowGraph): string;
2538
+ toJSON(): string;
2539
+ toTextEdges(): string;
2540
+ setLabel(label: string): void;
2541
+ toDigraph(): string;
2542
+ listSources(node: string): string[];
2543
+ listTargets(node: string): string[];
2544
+ /** removes all nodes containing "#" that have one in-going and one out-going edge */
2545
+ reduce(): this;
2546
+ }
2547
+
2518
2548
  declare class For extends Expression {
2519
2549
  getRunnable(): IStatementRunnable;
2520
2550
  }
@@ -6003,6 +6033,15 @@ declare class StartOfSelection implements IStatement {
6003
6033
  getMatcher(): IStatementRunnable;
6004
6034
  }
6005
6035
 
6036
+ export declare class StatementFlow {
6037
+ private counter;
6038
+ build(stru: StructureNode): FlowGraph[];
6039
+ private findBody;
6040
+ private buildName;
6041
+ private traverseBody;
6042
+ private traverseStructure;
6043
+ }
6044
+
6006
6045
  declare class StatementNode extends AbstractNode<ExpressionNode | TokenNode> {
6007
6046
  private readonly statement;
6008
6047
  private readonly colon;
@@ -11,6 +11,9 @@ class FlowGraph {
11
11
  getStart() {
12
12
  return this.startNode;
13
13
  }
14
+ getLabel() {
15
+ return this.label;
16
+ }
14
17
  getEnd() {
15
18
  return this.endNode;
16
19
  }
@@ -153,6 +153,7 @@ class StatementFlow {
153
153
  || type instanceof Structures.With
154
154
  || type instanceof Structures.Provide
155
155
  || type instanceof Structures.Select
156
+ || type instanceof Structures.LoopAtScreen
156
157
  || type instanceof Structures.Do) {
157
158
  const loopName = this.buildName(n.getFirstStatement());
158
159
  const sub = this.traverseBody(this.findBody(n), Object.assign(Object.assign({}, context), { loopStart: loopName, loopEnd: graph.getEnd() }));
@@ -161,6 +162,25 @@ class StatementFlow {
161
162
  graph.addEdge(sub.getEnd(), loopName);
162
163
  graph.addEdge(loopName, graph.getEnd());
163
164
  }
165
+ else if (type instanceof Structures.Data
166
+ || type instanceof Structures.Types) {
167
+ // these doesnt affect control flow, so just take the first statement
168
+ const statement = n.getFirstStatement();
169
+ const name = this.buildName(statement);
170
+ graph.addEdge(current, name);
171
+ graph.addEdge(name, graph.getEnd());
172
+ }
173
+ else if (type instanceof Structures.AtFirst
174
+ || type instanceof Structures.AtLast
175
+ || type instanceof Structures.At
176
+ || type instanceof Structures.OnChange) {
177
+ const name = this.buildName(n.getFirstStatement());
178
+ const body = this.traverseBody(this.findBody(n), context);
179
+ graph.addEdge(current, name);
180
+ graph.addGraph(name, body);
181
+ graph.addEdge(body.getEnd(), graph.getEnd());
182
+ graph.addEdge(current, graph.getEnd());
183
+ }
164
184
  else if (type instanceof Structures.Try) {
165
185
  const tryName = this.buildName(n.getFirstStatement());
166
186
  const body = this.traverseBody(this.findBody(n), context);
@@ -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.14";
70
+ return "2.112.16";
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.14",
3
+ "version": "2.112.16",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",