@syntest/analysis-javascript
Version:
SynTest CFG JavaScript is a library for generating control flow graphs for the JavaScript language
65 lines • 2.37 kB
JavaScript
;
/*
* Copyright 2020-2023 Delft University of Technology and SynTest contributors
*
* This file is part of SynTest Framework - SynTest Javascript.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.elementTypeToTypingType = exports.TypeEnum = void 0;
const Element_1 = require("../discovery/element/Element");
var TypeEnum;
(function (TypeEnum) {
TypeEnum["NUMERIC"] = "numeric";
TypeEnum["INTEGER"] = "integer";
TypeEnum["STRING"] = "string";
TypeEnum["BOOLEAN"] = "boolean";
TypeEnum["NULL"] = "null";
TypeEnum["UNDEFINED"] = "undefined";
TypeEnum["REGEX"] = "regex";
TypeEnum["ARRAY"] = "array";
TypeEnum["OBJECT"] = "object";
TypeEnum["FUNCTION"] = "function";
})(TypeEnum = exports.TypeEnum || (exports.TypeEnum = {}));
function elementTypeToTypingType(elementType) {
switch (elementType) {
case Element_1.ElementType.StringLiteral: {
return TypeEnum.STRING;
}
case Element_1.ElementType.NumericalLiteral: {
return TypeEnum.NUMERIC;
}
case Element_1.ElementType.NullLiteral: {
return TypeEnum.NULL;
}
case Element_1.ElementType.BooleanLiteral: {
return TypeEnum.BOOLEAN;
}
case Element_1.ElementType.RegExpLiteral: {
return TypeEnum.REGEX;
}
case Element_1.ElementType.TemplateLiteral: {
return TypeEnum.STRING;
}
case Element_1.ElementType.BigIntLiteral: {
return TypeEnum.NUMERIC;
}
case Element_1.ElementType.Undefined: {
return TypeEnum.UNDEFINED;
}
}
throw new Error("Unknown element type");
}
exports.elementTypeToTypingType = elementTypeToTypingType;
//# sourceMappingURL=TypeEnum.js.map