@abaplint/core
Version:
abaplint - Core API
40 lines • 2.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parameter = void 0;
const Expressions = require("../../2_statements/expressions");
const _typed_identifier_1 = require("../../types/_typed_identifier");
const basic_1 = require("../../types/basic");
const basic_types_1 = require("../basic_types");
const _syntax_input_1 = require("../_syntax_input");
const tokens_1 = require("../../1_lexer/tokens");
class Parameter {
runSyntax(node, input) {
var _a;
const nameToken = (_a = node.findFirstExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
if (nameToken && nameToken.getStr().length > 8) {
const message = "Parameter name too long, " + nameToken.getStr();
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
return;
}
else if (nameToken === undefined) {
return;
}
if (node.findDirectTokenByText("RADIOBUTTON") && node.findDirectTokenByText("LENGTH")) {
const message = "RADIOBUTTON and LENGTH not possible together";
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
return;
}
const bfound = new basic_types_1.BasicTypes(input).parseType(node);
if (bfound) {
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, bfound));
}
else {
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(nameToken, input.filename, new basic_1.UnknownType("Parameter, fallback")));
}
const magicName = "%_" + nameToken.getStr() + "_%_app_%";
const magicToken = new tokens_1.Identifier(nameToken.getStart(), magicName);
input.scope.addIdentifier(new _typed_identifier_1.TypedIdentifier(magicToken, input.filename, basic_1.VoidType.get("PARAMETER magic")));
}
}
exports.Parameter = Parameter;
//# sourceMappingURL=parameter.js.map