@autorest/powershell
Version:
AutoRest PowerShell Cmdlet Generator
38 lines • 1.74 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.isReserved = exports.getEscapedReservedName = void 0;
const reservedWords = new Set([
'abstract', 'as', 'async', 'await', 'base',
'bool', 'break', 'byte', 'case', 'catch',
'char', 'checked', 'class', 'const', 'continue',
'decimal', 'default', 'delegate', 'do', 'double',
'dynamic', 'else', 'enum', 'event', 'explicit',
'extern', 'false', 'finally', 'fixed', 'float',
'for', 'foreach', 'from', 'global', 'goto',
'if', 'implicit', 'in', 'int', 'interface',
'internal', 'is', 'lock', 'long', 'namespace',
'new', 'null', 'object', 'operator', 'out',
'override', 'params', 'private', 'protected', 'public',
'readonly', 'ref', 'return', 'sbyte', 'sealed',
'short', 'sizeof', 'stackalloc', 'static', 'string',
'struct', 'switch', 'this', 'throw', 'true',
'try', 'typeof', 'uint', 'ulong', 'unchecked',
'unsafe', 'ushort', 'using', 'virtual', 'void',
'volatile', 'while', 'yield', 'var'
]);
function getEscapedReservedName(name, appendValue) {
if (isReserved(name)) {
return name + appendValue;
}
return name;
}
exports.getEscapedReservedName = getEscapedReservedName;
function isReserved(name) {
return reservedWords.has(name.toLowerCase());
}
exports.isReserved = isReserved;
//# sourceMappingURL=code-namer.js.map
;