UNPKG

@abaplint/core

Version:
37 lines 2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Tables = void 0; const Expressions = require("../../2_statements/expressions"); const _typed_identifier_1 = require("../../types/_typed_identifier"); const unknown_type_1 = require("../../types/basic/unknown_type"); const _scope_type_1 = require("../_scope_type"); class Tables { runSyntax(node, input) { var _a, _b; const nameToken = (_a = node.findFirstExpression(Expressions.Field)) === null || _a === void 0 ? void 0 : _a.getFirstToken(); if (nameToken === undefined) { return undefined; } let name = nameToken.getStr(); if (name.startsWith("*")) { name = name.substring(1); } // lookupTableOrView will also give Unknown and Void const found = (_b = input.scope.getDDIC()) === null || _b === void 0 ? void 0 : _b.lookupTableOrView(name); if (found) { input.scope.getDDICReferences().addUsing(input.scope.getParentObj(), { object: found.object, filename: input.filename, token: nameToken }); if (input.scope.getType() === _scope_type_1.ScopeType.Form || input.scope.getType() === _scope_type_1.ScopeType.FunctionModule) { // hoist TABLES definitions to global scope input.scope.addNamedIdentifierToParent(nameToken.getStr(), new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, found.type, ["tables" /* IdentifierMeta.Tables */])); } else { input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, found.type, ["tables" /* IdentifierMeta.Tables */])); } return; } // this should never happen, input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, new unknown_type_1.UnknownType("Tables, fallback"))); } } exports.Tables = Tables; //# sourceMappingURL=tables.js.map