@abaplint/core 2.85.9 → 2.85.13

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/README.md CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  [abaplint](https://abaplint.org/) core library
4
4
 
5
- Exposes functionallity like the parser and rules, which can be used in other projects.
5
+ Exposes functionality like the parser and rules, which can be used in other projects.
6
6
 
7
7
  For more information see https://github.com/abaplint/abaplint
@@ -9,7 +9,7 @@ class TypeTableKey extends combi_1.Expression {
9
9
  const uniqueness = (0, combi_1.alt)("NON-UNIQUE", "UNIQUE");
10
10
  const defaultKey = "DEFAULT KEY";
11
11
  const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, "EMPTY KEY");
12
- const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", (0, combi_1.plus)(_1.FieldSub)), (0, combi_1.plus)(_1.FieldSub)))));
12
+ const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", (0, combi_1.plus)(_1.FieldSub)), (0, combi_1.plus)(_1.FieldSub)))), (0, combi_1.optPrio)("READ-ONLY"));
13
13
  return key;
14
14
  }
15
15
  }
@@ -7,6 +7,9 @@ class TypeUtils {
7
7
  if (type === undefined) {
8
8
  return false;
9
9
  }
10
+ else if (type instanceof basic_1.TableType && type.isWithHeader()) {
11
+ return this.isCharLike(type.getRowType());
12
+ }
10
13
  else if (type instanceof basic_1.StructureType) {
11
14
  for (const c of type.getComponents()) {
12
15
  if (this.isCharLike(c.type) === false) {
@@ -20,6 +23,13 @@ class TypeUtils {
20
23
  || type instanceof basic_1.AnyType
21
24
  || type instanceof basic_1.UnknownType
22
25
  || type instanceof basic_1.NumericType
26
+ || type instanceof basic_1.IntegerType
27
+ || type instanceof basic_1.FloatType
28
+ || type instanceof basic_1.FloatingPointType
29
+ || type instanceof basic_1.DecFloatType
30
+ || type instanceof basic_1.DecFloat16Type
31
+ || type instanceof basic_1.DecFloat34Type
32
+ || type instanceof basic_1.NumericGenericType
23
33
  || type instanceof basic_1.CSequenceType
24
34
  || type instanceof basic_1.DateType
25
35
  || type instanceof basic_1.CLikeType
@@ -53,8 +63,8 @@ class TypeUtils {
53
63
  }
54
64
  static isAssignable(source, target) {
55
65
  /*
56
- console.dir(source);
57
- console.dir(target);
66
+ console.dir(source);
67
+ console.dir(target);
58
68
  */
59
69
  if (target instanceof basic_1.TableType) {
60
70
  if (target.isWithHeader()) {
@@ -97,8 +107,13 @@ class TypeUtils {
97
107
  || source instanceof basic_1.UnknownType) {
98
108
  return true;
99
109
  }
100
- else if (this.isCharLike(target)
101
- && (this.isCharLike(source) || source instanceof basic_1.IntegerType)) {
110
+ else if (target.containsVoid() === true) {
111
+ return true;
112
+ }
113
+ else if (source instanceof basic_1.IntegerType) {
114
+ return false;
115
+ }
116
+ else if (this.isCharLike(target) && this.isCharLike(source)) {
102
117
  return true;
103
118
  }
104
119
  return false;
@@ -18,7 +18,7 @@ class AttributeChain {
18
18
  if (!(first.get() instanceof expressions_1.AttributeName)) {
19
19
  throw new Error("AttributeChain, unexpected first child");
20
20
  }
21
- const def = scope.findClassDefinition(inputContext.getIdentifierName());
21
+ const def = scope.findObjectDefinition(inputContext.getIdentifierName());
22
22
  if (def === undefined) {
23
23
  throw new Error("Definition for \"" + inputContext.getIdentifierName() + "\" not found in scope(AttributeChain)");
24
24
  }
@@ -8,6 +8,9 @@ class Constant {
8
8
  if (node.findDirectExpression(expressions_1.Integer)) {
9
9
  return new basic_1.IntegerType("I");
10
10
  }
11
+ else if (node.getFirstToken().getStr().startsWith("'")) {
12
+ return new basic_1.CharacterType(10);
13
+ }
11
14
  else {
12
15
  return new basic_1.StringType("STRING");
13
16
  }
@@ -5,11 +5,18 @@ const Expressions = require("../../2_statements/expressions");
5
5
  const source_1 = require("../expressions/source");
6
6
  const target_1 = require("../expressions/target");
7
7
  const dynamic_1 = require("../expressions/dynamic");
8
+ const _type_utils_1 = require("../_type_utils");
8
9
  class Write {
9
10
  runSyntax(node, scope, filename) {
10
11
  // todo, more
12
+ const second = node.getChildren()[1];
11
13
  for (const s of node.findAllExpressions(Expressions.Source)) {
12
- new source_1.Source().runSyntax(s, scope, filename);
14
+ const type = new source_1.Source().runSyntax(s, scope, filename);
15
+ if (s === second
16
+ && _type_utils_1.TypeUtils.isCharLike(type) === false
17
+ && _type_utils_1.TypeUtils.isHexLike(type) === false) {
18
+ throw new Error("Source not character like");
19
+ }
13
20
  }
14
21
  for (const s of node.findAllExpressions(Expressions.Dynamic)) {
15
22
  new dynamic_1.Dynamic().runSyntax(s, scope, filename);
@@ -43,7 +43,7 @@ class StructureType extends _abstract_type_1.AbstractType {
43
43
  return "StructureTypetoABAPtodo";
44
44
  }
45
45
  containsVoid() {
46
- return this.getComponents().some(c => { c.type.containsVoid(); });
46
+ return this.getComponents().some(c => { return c.type.containsVoid(); });
47
47
  }
48
48
  toCDS() {
49
49
  return "abap.TODO_STRUCTURE";
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.85.9";
71
+ return "2.85.13";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -19,8 +19,8 @@ class IdenticalContents extends _abap_rule_1.ABAPRule {
19
19
  return {
20
20
  key: "identical_contents",
21
21
  title: "Identical contents",
22
- shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.
23
-
22
+ shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.`,
23
+ extendedInformation: `
24
24
  Prerequsites: code is pretty printed with identical cAsE
25
25
 
26
26
  Chained statments are ignored`,
@@ -6,6 +6,7 @@ const _abap_rule_1 = require("./_abap_rule");
6
6
  const _basic_rule_config_1 = require("./_basic_rule_config");
7
7
  const objects_1 = require("../objects");
8
8
  const _irule_1 = require("./_irule");
9
+ const version_1 = require("../version");
9
10
  class LocalTestclassLocationConf extends _basic_rule_config_1.BasicRuleConfig {
10
11
  }
11
12
  exports.LocalTestclassLocationConf = LocalTestclassLocationConf;
@@ -33,6 +34,10 @@ class LocalTestclassLocation extends _abap_rule_1.ABAPRule {
33
34
  }
34
35
  runParsed(file, obj) {
35
36
  const issues = [];
37
+ if (this.reg.getConfig().getVersion() === version_1.Version.v700) {
38
+ // 700 does not have testclass includes
39
+ return [];
40
+ }
36
41
  if (!(obj instanceof objects_1.Class)) {
37
42
  return [];
38
43
  }
@@ -66,7 +66,7 @@ class UnusedVariables {
66
66
  shortDescription: `Checks for unused variables and constants`,
67
67
  extendedInformation: `WARNING: slow
68
68
 
69
- Experimental, might give false positives. Skips event parameters.
69
+ Skips event parameters.
70
70
 
71
71
  Note that this currently does not work if the source code uses macros.
72
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.85.9",
3
+ "version": "2.85.13",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@microsoft/api-extractor": "^7.19.4",
49
49
  "@types/chai": "^4.3.0",
50
50
  "@types/mocha": "^9.1.0",
51
- "@types/node": "^17.0.14",
51
+ "@types/node": "^17.0.16",
52
52
  "chai": "^4.3.6",
53
53
  "eslint": "^8.8.0",
54
54
  "mocha": "^9.2.0",
@@ -58,7 +58,7 @@
58
58
  "typescript": "^4.5.5"
59
59
  },
60
60
  "dependencies": {
61
- "fast-xml-parser": "^4.0.1",
61
+ "fast-xml-parser": "^4.0.2",
62
62
  "json5": "^2.2.0",
63
63
  "vscode-languageserver-protocol": "^3.16.0",
64
64
  "vscode-languageserver-types": "^3.16.0"