@abaplint/core 2.95.11 → 2.95.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.
@@ -5,16 +5,17 @@ const basic_1 = require("../../types/basic");
5
5
  const Expressions = require("../../2_statements/expressions");
6
6
  const source_1 = require("./source");
7
7
  const _type_utils_1 = require("../_type_utils");
8
+ const basic_types_1 = require("../basic_types");
8
9
  class Cast {
9
10
  runSyntax(node, scope, targetType, filename) {
10
- var _a;
11
11
  const sourceNode = node.findDirectExpression(Expressions.Source);
12
12
  if (sourceNode === undefined) {
13
13
  throw new Error("Cast, source node not found");
14
14
  }
15
15
  const sourceType = new source_1.Source().runSyntax(sourceNode, scope, filename);
16
16
  let tt = undefined;
17
- const typeName = (_a = node.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr();
17
+ const typeExpression = node.findDirectExpression(Expressions.TypeNameOrInfer);
18
+ const typeName = typeExpression === null || typeExpression === void 0 ? void 0 : typeExpression.concatTokens();
18
19
  if (typeName === undefined) {
19
20
  throw new Error("Cast, child TypeNameOrInfer not found");
20
21
  }
@@ -24,21 +25,28 @@ class Cast {
24
25
  else if (typeName === "#") {
25
26
  throw new Error("Cast, todo, infer type");
26
27
  }
27
- if (tt === undefined) {
28
- const found = scope.findObjectDefinition(typeName);
29
- if (found === undefined && scope.getDDIC().inErrorNamespace(typeName) === false) {
28
+ if (tt === undefined && typeExpression) {
29
+ const basic = new basic_types_1.BasicTypes(filename, scope);
30
+ tt = basic.parseType(typeExpression);
31
+ if (tt === undefined || tt instanceof basic_1.VoidType || tt instanceof basic_1.UnknownType) {
32
+ const found = scope.findObjectDefinition(typeName);
33
+ if (found) {
34
+ tt = new basic_1.ObjectReferenceType(found, typeName);
35
+ }
36
+ }
37
+ else {
38
+ tt = new basic_1.DataReference(tt, typeName);
39
+ }
40
+ if (tt === undefined && scope.getDDIC().inErrorNamespace(typeName) === false) {
30
41
  tt = new basic_1.VoidType(typeName);
31
42
  }
32
43
  else if (typeName.toUpperCase() === "OBJECT") {
33
44
  return new basic_1.GenericObjectReferenceType();
34
45
  }
35
- else if (found === undefined) {
46
+ else if (tt === undefined) {
36
47
  // todo, this should be an UnknownType instead?
37
48
  throw new Error("Type \"" + typeName + "\" not found in scope, Cast");
38
49
  }
39
- else {
40
- tt = new basic_1.ObjectReferenceType(found, typeName);
41
- }
42
50
  }
43
51
  new source_1.Source().addIfInferred(node, scope, filename, tt);
44
52
  if (new _type_utils_1.TypeUtils(scope).isCastable(sourceType, tt) === false) {
@@ -9,6 +9,9 @@ class Parameter {
9
9
  runSyntax(node, scope, filename) {
10
10
  var _a;
11
11
  const nameToken = (_a = node.findFirstExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
12
+ if (nameToken && nameToken.getStr().length > 8) {
13
+ throw new Error("Parameter name too long, " + nameToken.getStr());
14
+ }
12
15
  const bfound = new basic_types_1.BasicTypes(filename, scope).parseType(node);
13
16
  if (nameToken && bfound) {
14
17
  scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, filename, bfound));
@@ -10,6 +10,9 @@ class SelectOption {
10
10
  runSyntax(node, scope, filename) {
11
11
  var _a;
12
12
  const nameToken = (_a = node.findFirstExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
13
+ if (nameToken && nameToken.getStr().length > 8) {
14
+ throw new Error("Select-option name too long, " + nameToken.getStr());
15
+ }
13
16
  for (const d of node.findDirectExpressions(Expressions.Dynamic)) {
14
17
  new dynamic_1.Dynamic().runSyntax(d, scope, filename);
15
18
  }
@@ -33,8 +33,12 @@ class Table extends _abstract_object_1.AbstractObject {
33
33
  return undefined;
34
34
  }
35
35
  getAllowedNaming() {
36
+ let length = 30;
37
+ if (this.getTableCategory() === TableCategory.Transparent) {
38
+ length = 16;
39
+ }
36
40
  return {
37
- maxLength: 30,
41
+ maxLength: length,
38
42
  allowNamespace: true,
39
43
  };
40
44
  }
@@ -11,7 +11,7 @@ class View extends _abstract_object_1.AbstractObject {
11
11
  }
12
12
  getAllowedNaming() {
13
13
  return {
14
- maxLength: 30,
14
+ maxLength: 16,
15
15
  allowNamespace: true,
16
16
  };
17
17
  }
@@ -63,7 +63,7 @@ class Registry {
63
63
  }
64
64
  static abaplintVersion() {
65
65
  // magic, see build script "version.sh"
66
- return "2.95.11";
66
+ return "2.95.13";
67
67
  }
68
68
  getDDICReferences() {
69
69
  return this.references;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.95.11",
3
+ "version": "2.95.13",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",