UNPKG

@vlocode/apex

Version:
73 lines 2.57 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApexTypeRef = exports.ApexSourceRange = void 0; const standardNamespace_json_1 = __importDefault(require("./standardNamespace.json")); var ApexSourceRange; (function (ApexSourceRange) { ApexSourceRange.empty = { start: { line: -1, column: -1 }, stop: { line: -1, column: -1 } }; /** * Get the Range of the tokens to which the specified context refers. * @param context Context to get the range for * @returns The range of the tokens to which the specified context refers */ function fromToken(context) { return { start: { line: context.start?.line ?? -1, column: (context.start?.column ?? -2) + 1 }, stop: { line: context.stop?.line ?? -1, column: (context.stop?.column ?? -3) + 2 } }; } ApexSourceRange.fromToken = fromToken; })(ApexSourceRange || (exports.ApexSourceRange = ApexSourceRange = {})); var ApexTypeRef; (function (ApexTypeRef) { const primitiveTypes = [ 'string', 'boolean', 'integer', 'decimal', 'long', 'double', 'date', 'datetime', 'time', 'id' ]; const systemTypes = [ 'map', 'set', 'list', 'void', 'object', 'sobject', 'blob' ]; const standardNamespaces = standardNamespace_json_1.default.map((namespace) => namespace.toLowerCase()); function fromString(name, source) { return { name, isSystemType: isSystemType(name), source }; } ApexTypeRef.fromString = fromString; function isPrimitiveType(typeName) { return systemTypes.includes(typeName.toLowerCase()) || primitiveTypes.includes(typeName.toLowerCase()); } ApexTypeRef.isPrimitiveType = isPrimitiveType; function isSystemType(typeName) { return systemTypes.includes(typeName.toLowerCase()) || primitiveTypes.includes(typeName.toLowerCase()); } ApexTypeRef.isSystemType = isSystemType; function isStandardNamespace(ns) { return standardNamespaces.includes(ns.split('.').shift().toLowerCase()); } ApexTypeRef.isStandardNamespace = isStandardNamespace; })(ApexTypeRef || (exports.ApexTypeRef = ApexTypeRef = {})); //# sourceMappingURL=types.js.map