Remove ES5 specific identifier handling

This commit is contained in:
Jake Bailey
2025-06-11 23:36:24 -07:00
parent 7eb74fd868
commit c356203d2b
38 changed files with 412 additions and 967 deletions
+10 -10
View File
@@ -6485,7 +6485,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return parentName;
}
const memberName = symbolName(type.symbol);
if (isIdentifierText(memberName, ScriptTarget.ES5)) {
if (isIdentifierText(memberName)) {
return appendReferenceToType(
parentName as TypeReferenceNode | ImportTypeNode,
factory.createTypeReferenceNode(memberName, /*typeArguments*/ undefined),
@@ -8509,7 +8509,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (isSingleOrDoubleQuote(firstChar) && some(symbol.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
return factory.createStringLiteral(getSpecifierForModuleSymbol(symbol, context));
}
if (index === 0 || canUsePropertyAccess(symbolName, languageVersion)) {
if (index === 0 || canUsePropertyAccess(symbolName)) {
const identifier = setEmitFlags(factory.createIdentifier(symbolName), EmitFlags.NoAsciiEscaping);
if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray<TypeNode | TypeParameterDeclaration>(typeParameterNodes));
identifier.symbol = symbol;
@@ -8569,7 +8569,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return fromNameType;
}
const rawName = unescapeLeadingUnderscores(symbol.escapedName);
return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
return createPropertyNameNodeForIdentifierOrLiteral(rawName, singleQuote, stringNamed, isMethod);
}
// See getNameForSymbolFromNameType for a stringy equivalent
@@ -8578,13 +8578,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (nameType) {
if (nameType.flags & TypeFlags.StringOrNumberLiteral) {
const name = "" + (nameType as StringLiteralType | NumberLiteralType).value;
if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && (stringNamed || !isNumericLiteralName(name))) {
if (!isIdentifierText(name) && (stringNamed || !isNumericLiteralName(name))) {
return factory.createStringLiteral(name, !!singleQuote);
}
if (isNumericLiteralName(name) && startsWith(name, "-")) {
return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(-name)));
}
return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
return createPropertyNameNodeForIdentifierOrLiteral(name, singleQuote, stringNamed, isMethod);
}
if (nameType.flags & TypeFlags.UniqueESSymbol) {
return factory.createComputedPropertyName(symbolToExpression((nameType as UniqueESSymbolType).symbol, context, SymbolFlags.Value));
@@ -9511,7 +9511,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
exports = arrayFrom(membersSet);
}
return filter(exports, m => isNamespaceMember(m) && isIdentifierText(m.escapedName as string, ScriptTarget.ESNext));
return filter(exports, m => isNamespaceMember(m) && isIdentifierText(m.escapedName as string));
}
function isTypeOnlyNamespace(symbol: Symbol) {
@@ -10169,7 +10169,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
!some(getPropertiesOfType(typeToSerialize), p => isLateBoundName(p.escapedName)) &&
!some(getPropertiesOfType(typeToSerialize), p => some(p.declarations, d => getSourceFileOfNode(d) !== ctxSrc)) &&
every(getPropertiesOfType(typeToSerialize), p => {
if (!isIdentifierText(symbolName(p), languageVersion)) {
if (!isIdentifierText(symbolName(p))) {
return false;
}
if (!(p.flags & SymbolFlags.Accessor)) {
@@ -10497,7 +10497,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
else if (localName === InternalSymbolName.ExportEquals) {
localName = "_exports";
}
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
localName = isIdentifierText(localName) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
return localName;
}
@@ -10588,7 +10588,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (nameType) {
if (nameType.flags & TypeFlags.StringOrNumberLiteral) {
const name = "" + (nameType as StringLiteralType | NumberLiteralType).value;
if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
if (!isIdentifierText(name) && !isNumericLiteralName(name)) {
return `"${escapeString(name, CharacterCodes.doubleQuote)}"`;
}
if (isNumericLiteralName(name) && startsWith(name, "-")) {
@@ -21839,7 +21839,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
path = `${str}`;
}
// Otherwise write a dotted name if possible
else if (isIdentifierText(str, getEmitScriptTarget(compilerOptions))) {
else if (isIdentifierText(str)) {
path = `${path}.${str}`;
}
// Failing that, check if the name is already a computed name
+1 -2
View File
@@ -25,7 +25,6 @@ import {
getEffectiveSetAccessorTypeAnnotationNode,
getEffectiveTypeAnnotationNode,
getEmitFlags,
getEmitScriptTarget,
getFunctionFlags,
getJSDocType,
getJSDocTypeAssertionType,
@@ -502,7 +501,7 @@ export function createSyntacticTypeNodeBuilder(
}
literal = literalNode;
}
if (literal.kind === SyntaxKind.StringLiteral && isIdentifierText(literal.text, getEmitScriptTarget(options))) {
if (literal.kind === SyntaxKind.StringLiteral && isIdentifierText(literal.text)) {
return factory.createIdentifier(literal.text);
}
if (literal.kind === SyntaxKind.NumericLiteral && !literal.text.startsWith("-")) {
+1 -1
View File
@@ -2371,7 +2371,7 @@ namespace Parser {
// Otherwise, if this isn't a well-known keyword-like identifier, give the generic fallback message.
const expressionText = isIdentifierNode(node) ? idText(node) : undefined;
if (!expressionText || !isIdentifierText(expressionText, languageVersion)) {
if (!expressionText || !isIdentifierText(expressionText)) {
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.SemicolonToken));
return;
}
+1 -1
View File
@@ -4364,7 +4364,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
createOptionValueDiagnostic("jsxFactory", Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory);
}
}
else if (options.reactNamespace && !isIdentifierText(options.reactNamespace, languageVersion)) {
else if (options.reactNamespace && !isIdentifierText(options.reactNamespace)) {
createOptionValueDiagnostic("reactNamespace", Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace);
}
+34 -65
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1819,7 +1819,7 @@ export function transformClassFields(context: TransformationContext): (x: Source
}
// If the class name was assigned from a string literal that is a valid identifier, create an
// identifier from it.
else if (isIdentifierText(node.emitNode.assignedName.text, languageVersion)) {
else if (isIdentifierText(node.emitNode.assignedName.text)) {
const prefixName = factory.createIdentifier(node.emitNode.assignedName.text);
getPrivateIdentifierEnvironment().data.className = prefixName;
}
+1 -2
View File
@@ -179,7 +179,6 @@ import {
PropertySignature,
pushIfUnique,
removeAllComments,
ScriptTarget,
SetAccessorDeclaration,
setCommentRange,
setEmitFlags,
@@ -1466,7 +1465,7 @@ export function transformDeclarations(context: TransformationContext): Transform
return undefined;
}
const nameStr = unescapeLeadingUnderscores(p.escapedName);
if (!isIdentifierText(nameStr, ScriptTarget.ESNext)) {
if (!isIdentifierText(nameStr)) {
return undefined; // unique symbol or non-identifier name - omit, since there's no syntax that can preserve it
}
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
+1 -2
View File
@@ -155,7 +155,6 @@ import {
PropertyAssignment,
PropertyDeclaration,
PropertyName,
ScriptTarget,
SetAccessorDeclaration,
setCommentRange,
setEmitFlags,
@@ -548,7 +547,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc
function getHelperVariableName(node: ClassLikeDeclaration | ClassElement) {
let declarationName = node.name && isIdentifier(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name) :
node.name && isPrivateIdentifier(node.name) && !isGeneratedIdentifier(node.name) ? idText(node.name).slice(1) :
node.name && isStringLiteral(node.name) && isIdentifierText(node.name.text, ScriptTarget.ESNext) ? node.name.text :
node.name && isStringLiteral(node.name) && isIdentifierText(node.name.text) ? node.name.text :
isClassLike(node) ? "class" : "member";
if (isGetAccessor(node)) declarationName = `get_${declarationName}`;
if (isSetAccessor(node)) declarationName = `set_${declarationName}`;
+5 -5
View File
@@ -10811,9 +10811,9 @@ export function isNumericLiteralName(name: string | __String): boolean {
}
/** @internal */
export function createPropertyNameNodeForIdentifierOrLiteral(name: string, target: ScriptTarget, singleQuote: boolean, stringNamed: boolean, isMethod: boolean): Identifier | StringLiteral | NumericLiteral {
export function createPropertyNameNodeForIdentifierOrLiteral(name: string, singleQuote: boolean, stringNamed: boolean, isMethod: boolean): Identifier | StringLiteral | NumericLiteral {
const isMethodNamedNew = isMethod && name === "new";
return !isMethodNamedNew && isIdentifierText(name, target) ? factory.createIdentifier(name) :
return !isMethodNamedNew && isIdentifierText(name) ? factory.createIdentifier(name) :
!stringNamed && !isMethodNamedNew && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) :
factory.createStringLiteral(name, !!singleQuote);
}
@@ -10927,14 +10927,14 @@ export function isOptionalJSDocPropertyLikeTag(node: Node): boolean {
}
/** @internal */
export function canUsePropertyAccess(name: string, languageVersion: ScriptTarget): boolean {
export function canUsePropertyAccess(name: string): boolean {
if (name.length === 0) {
return false;
}
const firstChar = name.charCodeAt(0);
return firstChar === CharacterCodes.hash ?
name.length > 1 && isIdentifierStart(name.charCodeAt(1), languageVersion) :
isIdentifierStart(firstChar, languageVersion);
name.length > 1 && isIdentifierStart(name.charCodeAt(1)) :
isIdentifierStart(firstChar);
}
/** @internal */
@@ -13,7 +13,6 @@ import {
ClassDeclaration,
ClassElement,
CodeFixContext,
CompilerOptions,
concatenate,
copyLeadingComments,
Diagnostics,
@@ -24,7 +23,6 @@ import {
forEach,
FunctionDeclaration,
FunctionExpression,
getEmitScriptTarget,
getNameOfDeclaration,
getQuotePreference,
getTokenAtPosition,
@@ -72,14 +70,14 @@ const errorCodes = [Diagnostics.This_constructor_function_may_be_converted_to_a_
registerCodeFix({
errorCodes,
getCodeActions(context: CodeFixContext) {
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, context.span.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()));
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, context.span.start, context.program.getTypeChecker(), context.preferences));
return [createCodeFixAction(fixId, changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId, Diagnostics.Convert_all_constructor_functions_to_classes)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, err) => doChange(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions())),
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, err) => doChange(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences)),
});
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, position: number, checker: TypeChecker, preferences: UserPreferences, compilerOptions: CompilerOptions): void {
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, position: number, checker: TypeChecker, preferences: UserPreferences): void {
const ctorSymbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, position))!;
if (!ctorSymbol || !ctorSymbol.valueDeclaration || !(ctorSymbol.flags & (SymbolFlags.Function | SymbolFlags.Variable))) {
// Bad input
@@ -212,7 +210,7 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, po
// f.x = expr
if (isAccessExpression(memberDeclaration) && (isFunctionExpression(assignmentExpr) || isArrowFunction(assignmentExpr))) {
const quotePreference = getQuotePreference(sourceFile, preferences);
const name = tryGetPropertyName(memberDeclaration, compilerOptions, quotePreference);
const name = tryGetPropertyName(memberDeclaration, quotePreference);
if (name) {
createFunctionLikeExpressionMember(members, assignmentExpr, name);
}
@@ -320,7 +318,7 @@ function isConstructorAssignment(x: ObjectLiteralElementLike | PropertyAccessExp
return false;
}
function tryGetPropertyName(node: AccessExpression, compilerOptions: CompilerOptions, quotePreference: QuotePreference): PropertyName | undefined {
function tryGetPropertyName(node: AccessExpression, quotePreference: QuotePreference): PropertyName | undefined {
if (isPropertyAccessExpression(node)) {
return node.name;
}
@@ -331,7 +329,7 @@ function tryGetPropertyName(node: AccessExpression, compilerOptions: CompilerOpt
}
if (isStringLiteralLike(propName)) {
return isIdentifierText(propName.text, getEmitScriptTarget(compilerOptions)) ? factory.createIdentifier(propName.text)
return isIdentifierText(propName.text) ? factory.createIdentifier(propName.text)
: isNoSubstitutionTemplateLiteral(propName) ? factory.createStringLiteral(propName.text, quotePreference === QuotePreference.Single)
: propName;
}
+1 -1
View File
@@ -506,7 +506,7 @@ function convertSingleImport(
import x from "x";
const [a, b, c] = x;
*/
const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers);
const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text), identifiers);
return convertedImports([
makeImport(factory.createIdentifier(tmp), /*namedImports*/ undefined, moduleSpecifier, quotePreference),
makeConst(/*modifiers*/ undefined, getSynthesizedDeepClone(name), factory.createIdentifier(tmp)),
@@ -16,7 +16,6 @@ import {
factory,
find,
flattenDiagnosticMessageText,
getEmitScriptTarget,
getNodeId,
getTokenAtPosition,
isExpression,
@@ -120,10 +119,9 @@ function addMissingConstraint(changes: textChanges.ChangeTracker, program: Progr
changes.insertText(sourceFile, declaration.name.end, ` extends ${constraint}`);
}
else {
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
const tracker = getNoopSymbolTrackerWithResolver({ program, host });
const importAdder = createImportAdder(sourceFile, program, preferences, host);
const typeNode = typeToAutoImportableTypeNode(checker, importAdder, constraint, /*contextNode*/ undefined, scriptTarget, /*flags*/ undefined, /*internalFlags*/ undefined, tracker);
const typeNode = typeToAutoImportableTypeNode(checker, importAdder, constraint, /*contextNode*/ undefined, /*flags*/ undefined, /*internalFlags*/ undefined, tracker);
if (typeNode) {
changes.replaceNode(sourceFile, declaration, factory.updateTypeParameterDeclaration(declaration, /*modifiers*/ undefined, declaration.name, typeNode, declaration.default));
importAdder.writeFixes(changes);
+6 -10
View File
@@ -41,7 +41,6 @@ import {
FunctionExpression,
getCheckFlags,
getClassLikeDeclarationOfSymbol,
getEmitScriptTarget,
getEscapedTextOfJsxAttributeName,
getFirstConstructorWithBody,
getNodeId,
@@ -105,7 +104,6 @@ import {
PropertyDeclaration,
QuotePreference,
ReturnStatement,
ScriptTarget,
setParent,
Signature,
SignatureKind,
@@ -348,8 +346,7 @@ function getInfo(sourceFile: SourceFile, tokenPos: number, errorCode: number, ch
}
if (isIdentifier(token) && isJsxOpeningLikeElement(token.parent)) {
const target = getEmitScriptTarget(program.getCompilerOptions());
const attributes = getUnmatchedAttributes(checker, target, token.parent);
const attributes = getUnmatchedAttributes(checker, token.parent);
if (!length(attributes)) return undefined;
return { kind: InfoKind.JsxAttributes, token, attributes, parentDeclaration: token.parent };
}
@@ -654,11 +651,10 @@ function addJsxAttributes(changes: textChanges.ChangeTracker, context: CodeFixCo
function addObjectLiteralProperties(changes: textChanges.ChangeTracker, context: CodeFixContextBase, info: ObjectLiteralInfo) {
const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
const quotePreference = getQuotePreference(context.sourceFile, context.preferences);
const target = getEmitScriptTarget(context.program.getCompilerOptions());
const checker = context.program.getTypeChecker();
const props = map(info.properties, prop => {
const initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
return factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer);
return factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, quotePreference, checker), initializer);
});
const options = {
leadingTriviaOption: textChanges.LeadingTriviaOption.Exclude,
@@ -751,7 +747,7 @@ function isObjectLiteralType(type: Type) {
((getObjectFlags(type) & ObjectFlags.ObjectLiteral) || (type.symbol && tryCast(singleOrUndefined(type.symbol.declarations), isTypeLiteralNode)));
}
function getUnmatchedAttributes(checker: TypeChecker, target: ScriptTarget, source: JsxOpeningLikeElement) {
function getUnmatchedAttributes(checker: TypeChecker, source: JsxOpeningLikeElement) {
const attrsType = checker.getContextualType(source.attributes);
if (attrsType === undefined) return emptyArray;
@@ -770,7 +766,7 @@ function getUnmatchedAttributes(checker: TypeChecker, target: ScriptTarget, sour
}
}
}
return filter(targetProps, targetProp => isIdentifierText(targetProp.name, target, LanguageVariant.JSX) && !((targetProp.flags & SymbolFlags.Optional || getCheckFlags(targetProp) & CheckFlags.Partial) || seenNames.has(targetProp.escapedName)));
return filter(targetProps, targetProp => isIdentifierText(targetProp.name, LanguageVariant.JSX) && !((targetProp.flags & SymbolFlags.Optional || getCheckFlags(targetProp) & CheckFlags.Partial) || seenNames.has(targetProp.escapedName)));
}
function tryGetContainingMethodDeclaration(node: ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode, callExpression: CallExpression) {
@@ -781,13 +777,13 @@ function tryGetContainingMethodDeclaration(node: ClassLikeDeclaration | Interfac
return declaration && declaration.parent === node ? declaration : undefined;
}
function createPropertyNameFromSymbol(symbol: Symbol, target: ScriptTarget, quotePreference: QuotePreference, checker: TypeChecker) {
function createPropertyNameFromSymbol(symbol: Symbol, quotePreference: QuotePreference, checker: TypeChecker) {
if (isTransientSymbol(symbol)) {
const prop = checker.symbolToNode(symbol, SymbolFlags.Value, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, InternalNodeBuilderFlags.WriteComputedProps);
if (prop && isComputedPropertyName(prop)) return prop;
}
// We're using these nodes as property names in an object literal; no need to quote names when not needed.
return createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === QuotePreference.Single, /*stringNamed*/ false, /*isMethod*/ false);
return createPropertyNameNodeForIdentifierOrLiteral(symbol.name, quotePreference === QuotePreference.Single, /*stringNamed*/ false, /*isMethod*/ false);
}
function findScope(node: Node) {
+3 -3
View File
@@ -304,7 +304,7 @@ function updateParameters(
declaration.dotDotDotToken,
declaration.name,
prev && prev.questionToken ? factory.createToken(SyntaxKind.QuestionToken) : declaration.questionToken,
getParameterType(importAdder, declaration.type, scriptTarget),
getParameterType(importAdder, declaration.type),
declaration.initializer,
),
);
@@ -347,8 +347,8 @@ function isOptionalPos(declarations: ConvertibleSignatureDeclaration[], pos: num
return length(declarations) && some(declarations, d => pos < length(d.parameters) && !!d.parameters[pos] && d.parameters[pos].questionToken === undefined);
}
function getParameterType(importAdder: ImportAdder, typeNode: TypeNode | undefined, scriptTarget: ScriptTarget) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
function getParameterType(importAdder: ImportAdder, typeNode: TypeNode | undefined) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode);
if (importableReference) {
importSymbols(importAdder, importableReference.symbols);
return importableReference.typeNode;
@@ -38,7 +38,6 @@ import {
findAncestor,
FunctionDeclaration,
GeneratedIdentifierFlags,
getEmitScriptTarget,
getSourceFileOfNode,
getSynthesizedDeepClone,
getTokenAtPosition,
@@ -241,7 +240,6 @@ function withContext<T>(
const sourceFile: SourceFile = context.sourceFile;
const program = context.program;
const typeChecker: TypeChecker = program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
const fixedNodes = new Set<Node>();
const expandoPropertiesAdded = new Set<Node>();
@@ -286,7 +284,7 @@ function withContext<T>(
const newProperties = [];
for (const symbol of elements) {
// non-valid names will not end up in declaration emit
if (!isIdentifierText(symbol.name, getEmitScriptTarget(program.getCompilerOptions()))) continue;
if (!isIdentifierText(symbol.name)) continue;
// already has an existing declaration
if (symbol.valueDeclaration && isVariableDeclaration(symbol.valueDeclaration)) continue;
@@ -1111,13 +1109,13 @@ function withContext<T>(
if (!minimizedTypeNode) {
return undefined;
}
const result = typeNodeToAutoImportableTypeNode(minimizedTypeNode, importAdder, scriptTarget);
const result = typeNodeToAutoImportableTypeNode(minimizedTypeNode, importAdder);
return isTruncated ? factory.createKeywordTypeNode(SyntaxKind.AnyKeyword) : result;
}
function typePredicateToTypeNode(typePredicate: TypePredicate, enclosingDeclaration: Node, flags = NodeBuilderFlags.None): TypeNode | undefined {
let isTruncated = false;
const result = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags | flags, declarationEmitInternalNodeBuilderFlags, {
const result = typePredicateToAutoImportableTypeNode(typeChecker, importAdder, typePredicate, enclosingDeclaration, declarationEmitNodeBuilderFlags | flags, declarationEmitInternalNodeBuilderFlags, {
moduleResolverHost: program,
trackSymbol() {
return true;
+4 -8
View File
@@ -10,7 +10,6 @@ import {
factory,
findAncestor,
getEffectiveBaseTypeNode,
getEmitScriptTarget,
getMeaningFromLocation,
getTextOfNode,
getTokenAtPosition,
@@ -33,7 +32,6 @@ import {
isStringLiteralLike,
Node,
NodeFlags,
ScriptTarget,
SemanticMeaning,
SourceFile,
Symbol,
@@ -67,16 +65,14 @@ registerCodeFix({
const info = getInfo(sourceFile, context.span.start, context, errorCode);
if (!info) return undefined;
const { node, suggestedSymbol } = info;
const target = getEmitScriptTarget(context.host.getCompilationSettings());
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, node, suggestedSymbol, target));
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, node, suggestedSymbol));
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId, Diagnostics.Fix_all_detected_spelling_errors)];
},
fixIds: [fixId],
getAllCodeActions: context =>
codeFixAll(context, errorCodes, (changes, diag) => {
const info = getInfo(diag.file, diag.start, context, diag.code);
const target = getEmitScriptTarget(context.host.getCompilationSettings());
if (info) doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
if (info) doChange(changes, context.sourceFile, info.node, info.suggestedSymbol);
}),
});
@@ -147,9 +143,9 @@ function getInfo(sourceFile: SourceFile, pos: number, context: CodeFixContextBas
return suggestedSymbol === undefined ? undefined : { node, suggestedSymbol };
}
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, node: Node, suggestedSymbol: Symbol, target: ScriptTarget) {
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, node: Node, suggestedSymbol: Symbol) {
const suggestion = symbolName(suggestedSymbol);
if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
if (!isIdentifierText(suggestion) && isPropertyAccessExpression(node.parent)) {
const valDecl = suggestedSymbol.valueDeclaration;
if (valDecl && isNamedDeclaration(valDecl) && isPrivateIdentifier(valDecl.name)) {
changes.replaceNode(sourceFile, node, factory.createIdentifier(suggestion));
+16 -18
View File
@@ -188,7 +188,6 @@ export function addNewNodeForMemberSymbol(
const declarations = symbol.getDeclarations();
const declaration = firstOrUndefined(declarations);
const checker = context.program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
/**
* (#49811)
@@ -227,7 +226,7 @@ export function addNewNodeForMemberSymbol(
case SyntaxKind.PropertyDeclaration:
let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, InternalNodeBuilderFlags.AllowUnresolvedNames, getNoopSymbolTrackerWithResolver(context));
if (importAdder) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode);
if (importableReference) {
typeNode = importableReference.typeNode;
importSymbols(importAdder, importableReference.symbols);
@@ -250,7 +249,7 @@ export function addNewNodeForMemberSymbol(
? [allAccessors.firstAccessor, allAccessors.secondAccessor]
: [allAccessors.firstAccessor];
if (importAdder) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode);
if (importableReference) {
typeNode = importableReference.typeNode;
importSymbols(importAdder, importableReference.symbols);
@@ -392,7 +391,6 @@ export function createSignatureDeclarationFromSignature(
): FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | undefined {
const program = context.program;
const checker = program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
const isJs = isInJSFile(enclosingDeclaration);
const flags = NodeBuilderFlags.NoTruncation
| NodeBuilderFlags.SuppressAnyReturnType
@@ -412,14 +410,14 @@ export function createSignatureDeclarationFromSignature(
let constraint = typeParameterDecl.constraint;
let defaultType = typeParameterDecl.default;
if (constraint) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(constraint, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(constraint);
if (importableReference) {
constraint = importableReference.typeNode;
importSymbols(importAdder, importableReference.symbols);
}
}
if (defaultType) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(defaultType, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(defaultType);
if (importableReference) {
defaultType = importableReference.typeNode;
importSymbols(importAdder, importableReference.symbols);
@@ -440,7 +438,7 @@ export function createSignatureDeclarationFromSignature(
const newParameters = sameMap(parameters, parameterDecl => {
let type = isJs ? undefined : parameterDecl.type;
if (type) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(type, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(type);
if (importableReference) {
type = importableReference.typeNode;
importSymbols(importAdder, importableReference.symbols);
@@ -460,7 +458,7 @@ export function createSignatureDeclarationFromSignature(
parameters = setTextRange(factory.createNodeArray(newParameters, parameters.hasTrailingComma), parameters);
}
if (type) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(type, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(type);
if (importableReference) {
type = importableReference.typeNode;
importSymbols(importAdder, importableReference.symbols);
@@ -596,17 +594,17 @@ function createTypeParameterName(index: number) {
}
/** @internal */
export function typeToAutoImportableTypeNode(checker: TypeChecker, importAdder: ImportAdder, type: Type, contextNode: Node | undefined, scriptTarget: ScriptTarget, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined {
export function typeToAutoImportableTypeNode(checker: TypeChecker, importAdder: ImportAdder, type: Type, contextNode: Node | undefined, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined {
const typeNode = checker.typeToTypeNode(type, contextNode, flags, internalFlags, tracker);
if (!typeNode) {
return undefined;
}
return typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget);
return typeNodeToAutoImportableTypeNode(typeNode, importAdder);
}
/** @internal */
export function typeNodeToAutoImportableTypeNode(typeNode: TypeNode, importAdder: ImportAdder, scriptTarget: ScriptTarget): TypeNode | undefined {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
export function typeNodeToAutoImportableTypeNode(typeNode: TypeNode, importAdder: ImportAdder): TypeNode | undefined {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode);
if (importableReference) {
importSymbols(importAdder, importableReference.symbols);
typeNode = importableReference.typeNode;
@@ -651,10 +649,10 @@ export function typeToMinimizedReferenceType(checker: TypeChecker, type: Type, c
}
/** @internal */
export function typePredicateToAutoImportableTypeNode(checker: TypeChecker, importAdder: ImportAdder, typePredicate: TypePredicate, contextNode: Node | undefined, scriptTarget: ScriptTarget, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined {
export function typePredicateToAutoImportableTypeNode(checker: TypeChecker, importAdder: ImportAdder, typePredicate: TypePredicate, contextNode: Node | undefined, flags?: NodeBuilderFlags, internalFlags?: InternalNodeBuilderFlags, tracker?: SymbolTracker): TypeNode | undefined {
let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, internalFlags, tracker);
if (typePredicateNode?.type && isImportTypeNode(typePredicateNode.type)) {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typePredicateNode.type, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typePredicateNode.type);
if (importableReference) {
importSymbols(importAdder, importableReference.symbols);
typePredicateNode = factory.updateTypePredicateNode(typePredicateNode, typePredicateNode.assertsModifier, typePredicateNode.parameterName, importableReference.typeNode);
@@ -715,7 +713,7 @@ function getArgumentTypesAndTypeParameters(checker: TypeChecker, importAdder: Im
// Widen the type so we don't emit nonsense annotations like "function fn(x: 3) {"
const widenedInstanceType = checker.getBaseTypeOfLiteralType(instanceType);
const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, scriptTarget, flags, internalFlags, tracker);
const argumentTypeNode = typeToAutoImportableTypeNode(checker, importAdder, widenedInstanceType, contextNode, flags, internalFlags, tracker);
if (!argumentTypeNode) {
continue;
}
@@ -733,7 +731,7 @@ function getArgumentTypesAndTypeParameters(checker: TypeChecker, importAdder: Im
// We instead want to output:
// function added<T extends string>(value: T) { ... }
const instanceTypeConstraint = instanceType.isTypeParameter() && instanceType.constraint && !isAnonymousObjectConstraintType(instanceType.constraint)
? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, scriptTarget, flags, internalFlags, tracker)
? typeToAutoImportableTypeNode(checker, importAdder, instanceType.constraint, contextNode, flags, internalFlags, tracker)
: undefined;
if (argumentTypeParameter) {
@@ -950,7 +948,7 @@ function findJsonProperty(obj: ObjectLiteralExpression, name: string): PropertyA
*
* @internal
*/
export function tryGetAutoImportableReferenceFromTypeNode(importTypeNode: TypeNode | undefined, scriptTarget: ScriptTarget): {
export function tryGetAutoImportableReferenceFromTypeNode(importTypeNode: TypeNode | undefined): {
typeNode: TypeNode;
symbols: Symbol[];
} | undefined {
@@ -970,7 +968,7 @@ export function tryGetAutoImportableReferenceFromTypeNode(importTypeNode: TypeNo
// it can't refer to reserved internal symbol names and such
return visitEachChild(node, visit, /*context*/ undefined);
}
const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
const name = getNameForExportedSymbol(firstIdentifier.symbol);
const qualifier = name !== firstIdentifier.text
? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name))
: node.qualifier;
+1 -2
View File
@@ -282,7 +282,7 @@ function createImportAdderWorker(sourceFile: SourceFile | FutureSourceFile, prog
function addImportFromExportedSymbol(exportedSymbol: Symbol, isValidTypeOnlyUseSite?: boolean, referenceImport?: ImportOrRequireAliasDeclaration) {
const moduleSymbol = Debug.checkDefined(exportedSymbol.parent, "Expected exported symbol to have module symbol as parent");
const symbolName = getNameForExportedSymbol(exportedSymbol, getEmitScriptTarget(compilerOptions));
const symbolName = getNameForExportedSymbol(exportedSymbol);
const checker = program.getTypeChecker();
const symbol = checker.getMergedSymbol(skipAlias(exportedSymbol, checker));
const exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, moduleSymbol, /*preferCapitalized*/ false, program, host, preferences, cancellationToken);
@@ -1296,7 +1296,6 @@ function getNewImportFixes(
}
namespacePrefix ||= moduleSymbolToValidIdentifier(
exportInfo.moduleSymbol,
getEmitScriptTarget(compilerOptions),
/*forceCapitalize*/ false,
);
qualification = { namespacePrefix, usagePosition };
+2 -5
View File
@@ -34,7 +34,6 @@ import {
forEach,
forEachEntry,
getContainingFunction,
getEmitScriptTarget,
getJSDocType,
getNameOfDeclaration,
getObjectFlags,
@@ -85,7 +84,6 @@ import {
PropertyName,
PropertySignature,
returnTrue,
ScriptTarget,
SetAccessorDeclaration,
setEmitFlags,
ShorthandPropertyAssignment,
@@ -423,7 +421,7 @@ function annotate(changes: textChanges.ChangeTracker, importAdder: ImportAdder,
const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined) : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined);
changes.addJSDocTags(sourceFile, parent, [typeTag]);
}
else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, getEmitScriptTarget(program.getCompilerOptions()))) {
else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder)) {
changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode);
}
}
@@ -435,9 +433,8 @@ function tryReplaceImportTypeNodeWithAutoImport(
sourceFile: SourceFile,
changes: textChanges.ChangeTracker,
importAdder: ImportAdder,
scriptTarget: ScriptTarget,
): boolean {
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode);
if (importableReference && changes.tryInsertTypeAnnotation(sourceFile, declaration, importableReference.typeNode)) {
forEach(importableReference.symbols, s => importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true));
return true;
+9 -10
View File
@@ -1461,7 +1461,7 @@ function getExhaustiveCaseSnippets(
}
tracker.addValue(enumValue);
}
const typeNode = codefix.typeToAutoImportableTypeNode(checker, importAdder, type, caseBlock, target);
const typeNode = codefix.typeToAutoImportableTypeNode(checker, importAdder, type, caseBlock);
if (!typeNode) {
return undefined;
}
@@ -1564,7 +1564,7 @@ function entityNameToExpression(entityName: EntityName, languageVersion: ScriptT
return entityName;
}
const unescapedName = unescapeLeadingUnderscores(entityName.right.escapedText);
if (canUsePropertyAccess(unescapedName, languageVersion)) {
if (canUsePropertyAccess(unescapedName)) {
return factory.createPropertyAccessExpression(
entityNameToExpression(entityName.left, languageVersion, quotePreference),
unescapedName,
@@ -1655,7 +1655,7 @@ function getJSCompletionEntries(
return;
}
const realName = unescapeLeadingUnderscores(name);
if (!uniqueNames.has(realName) && isIdentifierText(realName, target)) {
if (!uniqueNames.has(realName) && isIdentifierText(realName)) {
uniqueNames.add(realName);
insertSorted(entries, {
name: realName,
@@ -1888,8 +1888,7 @@ function createCompletionEntry(
const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
if (parentNamedImportOrExport) {
const languageVersion = getEmitScriptTarget(host.getCompilationSettings());
if (!isIdentifierText(name, languageVersion)) {
if (!isIdentifierText(name)) {
insertText = quotePropertyName(sourceFile, preferences, name);
if (parentNamedImportOrExport.kind === SyntaxKind.NamedImports) {
@@ -1898,7 +1897,7 @@ function createCompletionEntry(
scanner.setText(sourceFile.text);
scanner.resetTokenState(position);
if (!(scanner.scan() === SyntaxKind.AsKeyword && scanner.scan() === SyntaxKind.Identifier)) {
insertText += " as " + generateIdentifierForArbitraryString(name, languageVersion);
insertText += " as " + generateIdentifierForArbitraryString(name);
}
}
}
@@ -1942,7 +1941,7 @@ function createCompletionEntry(
};
}
function generateIdentifierForArbitraryString(text: string, languageVersion: ScriptTarget | undefined): string {
function generateIdentifierForArbitraryString(text: string): string {
let needsUnderscore = false;
let identifier = "";
let ch: number | undefined;
@@ -1950,7 +1949,7 @@ function generateIdentifierForArbitraryString(text: string, languageVersion: Scr
// Convert "(example, text)" into "_example_text_"
for (let i = 0; i < text.length; i += ch !== undefined && ch >= 0x10000 ? 2 : 1) {
ch = text.codePointAt(i);
if (ch !== undefined && (i === 0 ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
if (ch !== undefined && (i === 0 ? isIdentifierStart(ch) : isIdentifierPart(ch))) {
if (needsUnderscore) identifier += "_";
identifier += String.fromCodePoint(ch);
needsUnderscore = false;
@@ -4165,7 +4164,7 @@ function getCompletionData(
sourceFile.path,
/*preferCapitalized*/ isRightOfOpenTag,
(symbolName, targetFlags) => {
if (!isIdentifierText(symbolName, getEmitScriptTarget(host.getCompilationSettings()))) return false;
if (!isIdentifierText(symbolName)) return false;
if (!detailsEntryId && isStringANonContextualKeyword(symbolName)) return false;
if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & SymbolFlags.Value)) return false;
if (isTypeOnlyLocation && !(targetFlags & (SymbolFlags.Module | SymbolFlags.Type))) return false;
@@ -5413,7 +5412,7 @@ function getCompletionEntryDisplayNameForSymbol(
}
const validNameResult: CompletionEntryDisplayNameForSymbol = { name, needsConvertPropertyAccess: false };
if (isIdentifierText(name, target, jsxIdentifierExpected ? LanguageVariant.JSX : LanguageVariant.Standard) || symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
if (isIdentifierText(name, jsxIdentifierExpected ? LanguageVariant.JSX : LanguageVariant.Standard) || symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
return validNameResult;
}
if (symbol.flags & SymbolFlags.Alias) {
+2 -2
View File
@@ -660,8 +660,8 @@ export function forEachNameOfDefaultExport<T>(defaultExport: Symbol, checker: Ty
for (const symbol of chain ?? emptyArray) {
if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
const final = cb(
moduleSymbolToValidIdentifier(symbol.parent, scriptTarget, /*forceCapitalize*/ false),
moduleSymbolToValidIdentifier(symbol.parent, scriptTarget, /*forceCapitalize*/ true),
moduleSymbolToValidIdentifier(symbol.parent, /*forceCapitalize*/ false),
moduleSymbolToValidIdentifier(symbol.parent, /*forceCapitalize*/ true),
);
if (final) return final;
}
+2 -3
View File
@@ -235,7 +235,6 @@ import {
ReferenceEntry,
RenameLocation,
ScriptElementKind,
ScriptTarget,
SemanticMeaning,
SetAccessorDeclaration,
SignatureDeclaration,
@@ -1804,8 +1803,8 @@ export namespace Core {
const endPosition = position + symbolNameLength;
if (
(position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) &&
(endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))
(position === 0 || !isIdentifierPart(text.charCodeAt(position - 1))) &&
(endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition)))
) {
// Found a real match. Keep searching.
positions.push(position);
+1 -3
View File
@@ -22,7 +22,6 @@ import {
GetAccessorDeclaration,
getEffectiveReturnTypeNode,
getEffectiveTypeAnnotationNode,
getEmitScriptTarget,
getLanguageVariant,
getLeadingCommentRanges,
getNameOfDeclaration,
@@ -146,7 +145,6 @@ function shouldUseInteractiveInlayHints(preferences: UserPreferences) {
export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
const { file, program, span, cancellationToken, preferences } = context;
const sourceFileText = file.text;
const compilerOptions = program.getCompilerOptions();
const quotePreference = getQuotePreference(file, preferences);
const checker = program.getTypeChecker();
@@ -353,7 +351,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
}
function leadingCommentsContainsParameterName(node: Node, name: string) {
if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions), getLanguageVariant(file.scriptKind))) {
if (!isIdentifierText(name, getLanguageVariant(file.scriptKind))) {
return false;
}
+2 -3
View File
@@ -7,7 +7,6 @@ import {
isUnicodeIdentifierStart,
last,
min,
ScriptTarget,
startsWith,
TextSpan,
} from "./_namespaces/ts.js";
@@ -385,7 +384,7 @@ function isUpperCaseLetter(ch: number) {
return true;
}
if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) {
if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch)) {
return false;
}
@@ -401,7 +400,7 @@ function isLowerCaseLetter(ch: number) {
return true;
}
if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) {
if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch)) {
return false;
}
+1 -2
View File
@@ -37,7 +37,6 @@ import {
QualifiedName,
RefactorContext,
RefactorEditInfo,
ScriptTarget,
some,
SourceFile,
Symbol,
@@ -222,7 +221,7 @@ export function doChangeNamedToNamespaceOrDefault(sourceFile: SourceFile, progra
toConvertSymbols.add(symbol);
}
});
const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ? moduleSpecifierToValidIdentifier(moduleSpecifier.text, ScriptTarget.ESNext) : "module";
const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ? moduleSpecifierToValidIdentifier(moduleSpecifier.text) : "module";
function hasNamespaceNameConflict(namedImport: ImportSpecifier): boolean {
// We need to check if the preferred namespace name (`preferredName`) we'd like to use in the refactored code will present a name conflict.
// A name conflict means that, in a scope where we would like to use the preferred namespace name, there already exists a symbol with that name in that scope.
+1 -3
View File
@@ -45,7 +45,6 @@ import {
getContainingClass,
getContainingFunction,
getEffectiveTypeParameterDeclarations,
getEmitScriptTarget,
getEnclosingBlockScopeContainer,
getLineAndCharacterOfPosition,
getLocaleSpecificMessage,
@@ -1043,7 +1042,6 @@ function extractFunctionInScope(
context: RefactorContext,
): RefactorEditInfo {
const checker = context.program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
const importAdder = codefix.createImportAdder(context.file, context.program, context.preferences, context.host);
// Make a unique name for the extracted function
@@ -1063,7 +1061,7 @@ function extractFunctionInScope(
let type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node);
// Widen the type so we don't emit nonsense annotations like "function fn(x: 3) {"
type = checker.getBaseTypeOfLiteralType(type);
typeNode = codefix.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, NodeBuilderFlags.NoTruncation, InternalNodeBuilderFlags.AllowUnresolvedNames);
typeNode = codefix.typeToAutoImportableTypeNode(checker, importAdder, type, scope, NodeBuilderFlags.NoTruncation, InternalNodeBuilderFlags.AllowUnresolvedNames);
}
const paramDecl = factory.createParameterDeclaration(
+1 -1
View File
@@ -89,5 +89,5 @@ export function addTargetFileImports(
}
});
addImportsForMovedSymbols(targetFileImportsFromOldFile, oldFile.fileName, importAdder, program);
addImportsForMovedSymbols(targetFileImportsFromOldFile, oldFile.fileName, importAdder);
}
+3 -6
View File
@@ -50,7 +50,6 @@ import {
GetCanonicalFileName,
getDecorators,
getDirectoryPath,
getEmitScriptTarget,
getLineAndCharacterOfPosition,
getLocaleSpecificMessage,
getModifiers,
@@ -135,7 +134,6 @@ import {
RefactorEditInfo,
RequireOrImportCall,
resolvePath,
ScriptTarget,
skipAlias,
some,
SourceFile,
@@ -253,7 +251,7 @@ export function getNewStatementsAndRemoveFromOldFile(
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, program, host, !!oldFile.commonJsModuleIndicator);
const quotePreference = getQuotePreference(oldFile, preferences);
addImportsForMovedSymbols(usage.oldFileImportsFromTargetFile, targetFile.fileName, importAdderForOldFile, program);
addImportsForMovedSymbols(usage.oldFileImportsFromTargetFile, targetFile.fileName, importAdderForOldFile);
deleteUnusedOldImports(oldFile, toMove.all, usage.unusedImportsFromOldFile, importAdderForOldFile);
importAdderForOldFile.writeFixes(changes, quotePreference);
deleteMovedStatements(oldFile, toMove.ranges, changes);
@@ -396,7 +394,7 @@ function updateNamespaceLikeImport(
oldImportNode: SupportedImport,
quotePreference: QuotePreference,
): void {
const preferredNewNamespaceName = moduleSpecifierToValidIdentifier(newModuleSpecifier, ScriptTarget.ESNext);
const preferredNewNamespaceName = moduleSpecifierToValidIdentifier(newModuleSpecifier);
let needUniqueName = false;
const toChange: Identifier[] = [];
FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, ref => {
@@ -512,10 +510,9 @@ export function addImportsForMovedSymbols(
symbols: Map<Symbol, boolean>,
targetFileName: string,
importAdder: codefix.ImportAdder,
program: Program,
): void {
for (const [symbol, isValidTypeOnlyUseSite] of symbols) {
const symbolName = getNameForExportedSymbol(symbol, getEmitScriptTarget(program.getCompilerOptions()));
const symbolName = getNameForExportedSymbol(symbol);
const exportKind = symbol.name === "default" && symbol.parent ? ExportKind.Default : ExportKind.Named;
importAdder.addImportForNonExistentExport(symbolName, targetFileName, exportKind, symbol.flags, isValidTypeOnlyUseSite);
}
+1 -1
View File
@@ -1375,7 +1375,7 @@ function getDirectoryFragmentTextSpan(text: string, textStart: number): TextSpan
const offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
const length = text.length - offset;
return length === 0 || isIdentifierText(text.substr(offset, length), ScriptTarget.ESNext) ? undefined : createTextSpan(textStart + offset, length);
return length === 0 || isIdentifierText(text.substr(offset, length)) ? undefined : createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
+7 -7
View File
@@ -4000,14 +4000,14 @@ export function firstOrOnly<T>(valueOrArray: T | readonly T[]): T {
* instead, which searches for names of re-exported defaults/namespaces in target files.
* @internal
*/
export function getNameForExportedSymbol(symbol: Symbol, scriptTarget: ScriptTarget | undefined, preferCapitalized?: boolean): string {
export function getNameForExportedSymbol(symbol: Symbol, preferCapitalized?: boolean): string {
if (symbol.escapedName === InternalSymbolName.ExportEquals || symbol.escapedName === InternalSymbolName.Default) {
// Names for default exports:
// - export default foo => foo
// - export { foo as default } => foo
// - export default 0 => filename converted to camelCase
return getDefaultLikeExportNameFromDeclaration(symbol)
|| moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
|| moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), !!preferCapitalized);
}
return symbol.name;
}
@@ -4054,17 +4054,17 @@ function getSymbolParentOrFail(symbol: Symbol) {
}
/** @internal */
export function moduleSymbolToValidIdentifier(moduleSymbol: Symbol, target: ScriptTarget | undefined, forceCapitalize: boolean): string {
return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target, forceCapitalize);
export function moduleSymbolToValidIdentifier(moduleSymbol: Symbol, forceCapitalize: boolean): string {
return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), forceCapitalize);
}
/** @internal */
export function moduleSpecifierToValidIdentifier(moduleSpecifier: string, target: ScriptTarget | undefined, forceCapitalize?: boolean): string {
export function moduleSpecifierToValidIdentifier(moduleSpecifier: string, forceCapitalize?: boolean): string {
const baseName = getBaseFileName(removeSuffix(removeFileExtension(moduleSpecifier), "/index"));
let res = "";
let lastCharWasValid = true;
const firstCharCode = baseName.charCodeAt(0);
if (isIdentifierStart(firstCharCode, target)) {
if (isIdentifierStart(firstCharCode)) {
res += String.fromCharCode(firstCharCode);
if (forceCapitalize) {
res = res.toUpperCase();
@@ -4075,7 +4075,7 @@ export function moduleSpecifierToValidIdentifier(moduleSpecifier: string, target
}
for (let i = 1; i < baseName.length; i++) {
const ch = baseName.charCodeAt(i);
const isValid = isIdentifierPart(ch, target);
const isValid = isIdentifierPart(ch);
if (isValid) {
let char = String.fromCharCode(ch);
if (!lastCharWasValid) {
@@ -88,7 +88,7 @@ export function extractTest(source: string): Test {
text += source.substring(lastPos, pos);
function consumeIdentifier() {
while (ts.isIdentifierPart(source.charCodeAt(pos), ts.ScriptTarget.Latest)) {
while (ts.isIdentifierPart(source.charCodeAt(pos))) {
pos++;
}
}
+2 -2
View File
@@ -8470,8 +8470,8 @@ declare namespace ts {
function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
/** Optionally, get the shebang */
function getShebang(text: string): string | undefined;
function isIdentifierStart(ch: number, languageVersion: ScriptTarget | undefined): boolean;
function isIdentifierPart(ch: number, languageVersion: ScriptTarget | undefined, identifierVariant?: LanguageVariant): boolean;
function isIdentifierStart(ch: number): boolean;
function isIdentifierPart(ch: number, identifierVariant?: LanguageVariant): boolean;
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, textInitial?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
type ErrorCallback = (message: DiagnosticMessage, length: number, arg0?: any) => void;
interface Scanner {
@@ -1,161 +1,37 @@
error TS-1: Pre-emit (44) and post-emit (45) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here!
astralAsSurrogatePair.ts(1,11): error TS1127: Invalid character.
astralAsSurrogatePair.ts(1,14): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'.
astralAsSurrogatePair.ts(1,17): error TS1127: Invalid character.
astralAsSurrogatePair.ts(1,18): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uD800'.
astralAsSurrogatePair.ts(1,23): error TS1127: Invalid character.
astralAsSurrogatePair.ts(1,24): error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'uDEA7'.
extendedEscapesForAstralsInVarsAndClasses.ts(2,5): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(2,7): error TS1134: Variable declaration expected.
extendedEscapesForAstralsInVarsAndClasses.ts(3,5): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(3,7): error TS1005: ',' expected.
extendedEscapesForAstralsInVarsAndClasses.ts(3,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
extendedEscapesForAstralsInVarsAndClasses.ts(6,5): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(6,8): error TS1128: Declaration or statement expected.
extendedEscapesForAstralsInVarsAndClasses.ts(9,5): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(9,6): error TS1434: Unexpected keyword or identifier.
extendedEscapesForAstralsInVarsAndClasses.ts(9,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
extendedEscapesForAstralsInVarsAndClasses.ts(9,15): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses.
extendedEscapesForAstralsInVarsAndClasses.ts(13,5): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(13,6): error TS1434: Unexpected keyword or identifier.
extendedEscapesForAstralsInVarsAndClasses.ts(13,7): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
extendedEscapesForAstralsInVarsAndClasses.ts(13,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
extendedEscapesForAstralsInVarsAndClasses.ts(13,14): error TS1128: Declaration or statement expected.
extendedEscapesForAstralsInVarsAndClasses.ts(14,5): error TS2304: Cannot find name 'constructor'.
extendedEscapesForAstralsInVarsAndClasses.ts(14,19): error TS1005: ';' expected.
extendedEscapesForAstralsInVarsAndClasses.ts(15,9): error TS2532: Object is possibly 'undefined'.
extendedEscapesForAstralsInVarsAndClasses.ts(15,14): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(15,15): error TS1434: Unexpected keyword or identifier.
extendedEscapesForAstralsInVarsAndClasses.ts(15,20): error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
extendedEscapesForAstralsInVarsAndClasses.ts(15,24): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses.
extendedEscapesForAstralsInVarsAndClasses.ts(17,5): error TS2304: Cannot find name 'methodA'.
extendedEscapesForAstralsInVarsAndClasses.ts(17,15): error TS1005: ';' expected.
extendedEscapesForAstralsInVarsAndClasses.ts(18,21): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(20,1): error TS1128: Declaration or statement expected.
extendedEscapesForAstralsInVarsAndClasses.ts(22,13): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(22,16): error TS1134: Variable declaration expected.
extendedEscapesForAstralsInVarsAndClasses.ts(22,18): error TS1389: 'new' is not allowed as a variable declaration name.
extendedEscapesForAstralsInVarsAndClasses.ts(22,28): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(22,29): error TS1434: Unexpected keyword or identifier.
extendedEscapesForAstralsInVarsAndClasses.ts(22,34): error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
extendedEscapesForAstralsInVarsAndClasses.ts(22,50): error TS2339: Property 'methodA' does not exist on type 'Foo'.
extendedEscapesForAstralsInVarsAndClasses.ts(24,2): error TS1127: Invalid character.
extendedEscapesForAstralsInVarsAndClasses.ts(24,3): error TS1434: Unexpected keyword or identifier.
extendedEscapesForAstralsInVarsAndClasses.ts(24,8): error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
extendedEscapesForAstralsInVarsAndClasses.ts(24,12): error TS1128: Declaration or statement expected.
!!! error TS-1: Pre-emit (44) and post-emit (45) diagnostic counts do not match! This can indicate that a semantic _error_ was added by the emit resolver - such an error may not be reflected on the command line or in the editor, but may be captured in a baseline here!
!!! related TS-1: The excess diagnostics are:
!!! related TS2532 extendedEscapesForAstralsInVarsAndClasses.ts:18:16: Object is possibly 'undefined'.
==== extendedEscapesForAstralsInVarsAndClasses.ts (38 errors) ====
==== extendedEscapesForAstralsInVarsAndClasses.ts (0 errors) ====
// U+102A7 CARIAN LETTER A2
var 𐊧: string;
~~
!!! error TS1127: Invalid character.
~
!!! error TS1134: Variable declaration expected.
var \u{102A7}: string;
!!! error TS1127: Invalid character.
~
!!! error TS1005: ',' expected.
~~
!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
if (Math.random()) {
𐊧 = "hello";
~~
!!! error TS1127: Invalid character.
~
!!! error TS1128: Declaration or statement expected.
}
else {
\u{102A7} = "hallo";
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~~
!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses.
}
class Foo {
\u{102A7}: string;
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~
!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
~
!!! error TS1128: Declaration or statement expected.
constructor() {
~~~~~~~~~~~
!!! error TS2304: Cannot find name 'constructor'.
~
!!! error TS1005: ';' expected.
this.\u{102A7} = " world";
~~~~
!!! error TS2532: Object is possibly 'undefined'.
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~~
!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses.
}
methodA() {
~~~~~~~
!!! error TS2304: Cannot find name 'methodA'.
~
!!! error TS1005: ';' expected.
return this.𐊧;
~~
!!! error TS1127: Invalid character.
}
}
~
!!! error TS1128: Declaration or statement expected.
export var _𐊧 = new Foo().\u{102A7} + new Foo().methodA();
~~
!!! error TS1127: Invalid character.
~
!!! error TS1134: Variable declaration expected.
~~~
!!! error TS1389: 'new' is not allowed as a variable declaration name.
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~~
!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
~~~~~~~
!!! error TS2339: Property 'methodA' does not exist on type 'Foo'.
_\u{102A7} += "!";
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~~
!!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal.
~~
!!! error TS1128: Declaration or statement expected.
==== astralAsSurrogatePair.ts (6 errors) ====
==== astralAsSurrogatePair.ts (4 errors) ====
import { _𐊧 as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js";
~~
!!! error TS1127: Invalid character.
~~
!!! error TS2305: Module '"./extendedEscapesForAstralsInVarsAndClasses.js"' has no exported member 'as'.
!!! error TS1127: Invalid character.
~~~~~
@@ -32,55 +32,24 @@ import { _𐊧 as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClass
//// [extendedEscapesForAstralsInVarsAndClasses.js]
// U+102A7 CARIAN LETTER A2
var string;
var u, { 102: A7 };
var 𐊧;
var \u{102A7};
if (Math.random()) {
"hello";
𐊧 = "hello";
}
else {
u;
{
102;
A7;
}
"hallo";
\u{102A7} = "hallo";
}
class Foo {
}
{
102;
A7;
}
string;
constructor();
{
this.;
u;
{
102;
A7;
constructor() {
this.\u{102A7} = " world";
}
methodA() {
return this.𐊧;
}
" world";
}
methodA();
{
return this.𐊧;
}
export var _;
new Foo().;
u;
{
102;
A7;
}
+new Foo().methodA();
_;
u;
{
102;
A7;
}
"!";
export var _𐊧 = new Foo().\u{102A7} + new Foo().methodA();
_\u{102A7} += "!";
//# sourceMappingURL=extendedEscapesForAstralsInVarsAndClasses.js.map
//// [astralAsSurrogatePair.js]
export {};
@@ -1,6 +1,6 @@
//// [extendedEscapesForAstralsInVarsAndClasses.js.map]
{"version":3,"file":"extendedEscapesForAstralsInVarsAndClasses.js","sourceRoot":"","sources":["extendedEscapesForAstralsInVarsAndClasses.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAQ,MAAM,CAAC;AACf,IAAK,CAAC,EAAA,EAAC,GAAG,EAAA,EAAE,EAAS,CAAC;AAEtB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACX,OAAO,CAAC;AACjB,CAAC;KACI,CAAC;IACD,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,GAAG;CACH;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAE,MAAM,CAAC;AAClB,WAAW,EAAE,CAAA;AAAC,CAAC;IACX,IAAI,CAAC,CAAA;IAAC,CAAC,CAAA;IAAA,CAAC;QAAA,GAAG,CAAA;QAAA,EAAE,CAAA;IAAA,CAAC;IAAG,QAAQ,CAAC;AAC9B,CAAC;AACD,OAAO,EAAE,CAAA;AAAC,CAAC;IACP,OAAO,IAAI,CAAC,EAAE,CAAC;AACnB,CAAC;AAGL,MAAM,CAAC,IAAI,CAAK,CAAA;AAAC,IAAI,GAAG,EAAE,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAC,CAAE,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE3D,CAAC,CAAA;AAAC,CAAC,CAAA;AAAA,CAAC;IAAA,GAAG,CAAA;IAAA,EAAE,CAAA;AAAA,CAAC;AAAI,GAAG,CAAC"}
//// https://sokra.github.io/source-map-visualization#base64,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyDQp2YXIgc3RyaW5nOw0KdmFyIHUsIHsgMTAyOiBBNyB9Ow0KaWYgKE1hdGgucmFuZG9tKCkpIHsNCiAgICAiaGVsbG8iOw0KfQ0KZWxzZSB7DQogICAgdTsNCiAgICB7DQogICAgICAgIDEwMjsNCiAgICAgICAgQTc7DQogICAgfQ0KICAgICJoYWxsbyI7DQp9DQpjbGFzcyBGb28gew0KfQ0Kew0KICAgIDEwMjsNCiAgICBBNzsNCn0NCnN0cmluZzsNCmNvbnN0cnVjdG9yKCk7DQp7DQogICAgdGhpcy47DQogICAgdTsNCiAgICB7DQogICAgICAgIDEwMjsNCiAgICAgICAgQTc7DQogICAgfQ0KICAgICIgd29ybGQiOw0KfQ0KbWV0aG9kQSgpOw0Kew0KICAgIHJldHVybiB0aGlzLu2ggO26pzsNCn0NCmV4cG9ydCB2YXIgXzsNCm5ldyBGb28oKS47DQp1Ow0Kew0KICAgIDEwMjsNCiAgICBBNzsNCn0NCituZXcgRm9vKCkubWV0aG9kQSgpOw0KXzsNCnU7DQp7DQogICAgMTAyOw0KICAgIEE3Ow0KfQ0KIiEiOw0KLy8jIHNvdXJjZU1hcHBpbmdVUkw9ZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMubWFw,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJleHRlbmRlZEVzY2FwZXNGb3JBc3RyYWxzSW5WYXJzQW5kQ2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQkFBMkI7QUFDM0IsSUFBUSxNQUFNLENBQUM7QUFDZixJQUFLLENBQUMsRUFBQSxFQUFDLEdBQUcsRUFBQSxFQUFFLEVBQVMsQ0FBQztBQUV0QixJQUFJLElBQUksQ0FBQyxNQUFNLEVBQUUsRUFBRSxDQUFDO0lBQ1gsT0FBTyxDQUFDO0FBQ2pCLENBQUM7S0FDSSxDQUFDO0lBQ0QsQ0FBQyxDQUFBO0lBQUEsQ0FBQztRQUFBLEdBQUcsQ0FBQTtRQUFBLEVBQUUsQ0FBQTtJQUFBLENBQUM7SUFBRyxPQUFPLENBQUM7QUFDeEIsQ0FBQztBQUVELE1BQU0sR0FBRztDQUNIO0FBQUEsQ0FBQztJQUFBLEdBQUcsQ0FBQTtJQUFBLEVBQUUsQ0FBQTtBQUFBLENBQUM7QUFBRSxNQUFNLENBQUM7QUFDbEIsV0FBVyxFQUFFLENBQUE7QUFBQyxDQUFDO0lBQ1gsSUFBSSxDQUFDLENBQUE7SUFBQyxDQUFDLENBQUE7SUFBQSxDQUFDO1FBQUEsR0FBRyxDQUFBO1FBQUEsRUFBRSxDQUFBO0lBQUEsQ0FBQztJQUFHLFFBQVEsQ0FBQztBQUM5QixDQUFDO0FBQ0QsT0FBTyxFQUFFLENBQUE7QUFBQyxDQUFDO0lBQ1AsT0FBTyxJQUFJLENBQUMsRUFBRSxDQUFDO0FBQ25CLENBQUM7QUFHTCxNQUFNLENBQUMsSUFBSSxDQUFLLENBQUE7QUFBQyxJQUFJLEdBQUcsRUFBRSxDQUFDLENBQUE7QUFBQyxDQUFDLENBQUE7QUFBQSxDQUFDO0lBQUEsR0FBRyxDQUFBO0lBQUEsRUFBRSxDQUFBO0FBQUEsQ0FBQztBQUFDLENBQUUsSUFBSSxHQUFHLEVBQUUsQ0FBQyxPQUFPLEVBQUUsQ0FBQztBQUUzRCxDQUFDLENBQUE7QUFBQyxDQUFDLENBQUE7QUFBQSxDQUFDO0lBQUEsR0FBRyxDQUFBO0lBQUEsRUFBRSxDQUFBO0FBQUEsQ0FBQztBQUFJLEdBQUcsQ0FBQyJ9,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyCnZhciDtoIDtuqc6IHN0cmluZzsKdmFyIFx1ezEwMkE3fTogc3RyaW5nOwoKaWYgKE1hdGgucmFuZG9tKCkpIHsKICAgIO2ggO26pyA9ICJoZWxsbyI7Cn0KZWxzZSB7CiAgICBcdXsxMDJBN30gPSAiaGFsbG8iOwp9CgpjbGFzcyBGb28gewogICAgXHV7MTAyQTd9OiBzdHJpbmc7CiAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICB0aGlzLlx1ezEwMkE3fSA9ICIgd29ybGQiOwogICAgfQogICAgbWV0aG9kQSgpIHsKICAgICAgICByZXR1cm4gdGhpcy7toIDtuqc7CiAgICB9Cn0KCmV4cG9ydCB2YXIgX+2ggO26pyA9IG5ldyBGb28oKS5cdXsxMDJBN30gKyBuZXcgRm9vKCkubWV0aG9kQSgpOwoKX1x1ezEwMkE3fSArPSAiISI7Cg==
{"version":3,"file":"extendedEscapesForAstralsInVarsAndClasses.js","sourceRoot":"","sources":["extendedEscapesForAstralsInVarsAndClasses.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAI,EAAU,CAAC;AACf,IAAI,SAAiB,CAAC;AAEtB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IAChB,EAAE,GAAG,OAAO,CAAC;AACjB,CAAC;KACI,CAAC;IACF,SAAS,GAAG,OAAO,CAAC;AACxB,CAAC;AAED,MAAM,GAAG;IAEL;QACI,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IACD,OAAO;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACnB,CAAC;CACJ;AAED,MAAM,CAAC,IAAI,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAE3D,UAAU,IAAI,GAAG,CAAC"}
//// https://sokra.github.io/source-map-visualization#base64,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyDQp2YXIg7aCA7bqnOw0KdmFyIFx1ezEwMkE3fTsNCmlmIChNYXRoLnJhbmRvbSgpKSB7DQogICAg7aCA7bqnID0gImhlbGxvIjsNCn0NCmVsc2Ugew0KICAgIFx1ezEwMkE3fSA9ICJoYWxsbyI7DQp9DQpjbGFzcyBGb28gew0KICAgIGNvbnN0cnVjdG9yKCkgew0KICAgICAgICB0aGlzLlx1ezEwMkE3fSA9ICIgd29ybGQiOw0KICAgIH0NCiAgICBtZXRob2RBKCkgew0KICAgICAgICByZXR1cm4gdGhpcy7toIDtuqc7DQogICAgfQ0KfQ0KZXhwb3J0IHZhciBf7aCA7bqnID0gbmV3IEZvbygpLlx1ezEwMkE3fSArIG5ldyBGb28oKS5tZXRob2RBKCk7DQpfXHV7MTAyQTd9ICs9ICIhIjsNCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWV4dGVuZGVkRXNjYXBlc0ZvckFzdHJhbHNJblZhcnNBbmRDbGFzc2VzLmpzLm1hcA==,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWRFc2NhcGVzRm9yQXN0cmFsc0luVmFyc0FuZENsYXNzZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJleHRlbmRlZEVzY2FwZXNGb3JBc3RyYWxzSW5WYXJzQW5kQ2xhc3Nlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQkFBMkI7QUFDM0IsSUFBSSxFQUFVLENBQUM7QUFDZixJQUFJLFNBQWlCLENBQUM7QUFFdEIsSUFBSSxJQUFJLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQztJQUNoQixFQUFFLEdBQUcsT0FBTyxDQUFDO0FBQ2pCLENBQUM7S0FDSSxDQUFDO0lBQ0YsU0FBUyxHQUFHLE9BQU8sQ0FBQztBQUN4QixDQUFDO0FBRUQsTUFBTSxHQUFHO0lBRUw7UUFDSSxJQUFJLENBQUMsU0FBUyxHQUFHLFFBQVEsQ0FBQztJQUM5QixDQUFDO0lBQ0QsT0FBTztRQUNILE9BQU8sSUFBSSxDQUFDLEVBQUUsQ0FBQztJQUNuQixDQUFDO0NBQ0o7QUFFRCxNQUFNLENBQUMsSUFBSSxHQUFHLEdBQUcsSUFBSSxHQUFHLEVBQUUsQ0FBQyxTQUFTLEdBQUcsSUFBSSxHQUFHLEVBQUUsQ0FBQyxPQUFPLEVBQUUsQ0FBQztBQUUzRCxVQUFVLElBQUksR0FBRyxDQUFDIn0=,Ly8gVSsxMDJBNyBDQVJJQU4gTEVUVEVSIEEyCnZhciDtoIDtuqc6IHN0cmluZzsKdmFyIFx1ezEwMkE3fTogc3RyaW5nOwoKaWYgKE1hdGgucmFuZG9tKCkpIHsKICAgIO2ggO26pyA9ICJoZWxsbyI7Cn0KZWxzZSB7CiAgICBcdXsxMDJBN30gPSAiaGFsbG8iOwp9CgpjbGFzcyBGb28gewogICAgXHV7MTAyQTd9OiBzdHJpbmc7CiAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICB0aGlzLlx1ezEwMkE3fSA9ICIgd29ybGQiOwogICAgfQogICAgbWV0aG9kQSgpIHsKICAgICAgICByZXR1cm4gdGhpcy7toIDtuqc7CiAgICB9Cn0KCmV4cG9ydCB2YXIgX+2ggO26pyA9IG5ldyBGb28oKS5cdXsxMDJBN30gKyBuZXcgRm9vKCkubWV0aG9kQSgpOwoKX1x1ezEwMkE3fSArPSAiISI7Cg==
//// [astralAsSurrogatePair.js.map]
{"version":3,"file":"astralAsSurrogatePair.js","sourceRoot":"","sources":["astralAsSurrogatePair.ts"],"names":[],"mappings":""}
@@ -16,55 +16,37 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 28) Source(1, 28) + SourceIndex(0)
---
>>>var string;
>>>var 𐊧;
1 >
2 >^^^^
3 > ^^^^^^
4 > ^
5 > ^^^^^^^^^->
3 > ^^
4 > ^
5 > ^^^^^^^^->
1 >
>
2 >var 𐊧:
3 > string
4 > ;
2 >var
3 > 𐊧: string
4 > ;
1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(2, 5) Source(2, 9) + SourceIndex(0)
3 >Emitted(2, 11) Source(2, 15) + SourceIndex(0)
4 >Emitted(2, 12) Source(2, 16) + SourceIndex(0)
2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0)
3 >Emitted(2, 7) Source(2, 15) + SourceIndex(0)
4 >Emitted(2, 8) Source(2, 16) + SourceIndex(0)
---
>>>var u, { 102: A7 };
>>>var \u{102A7};
1->
2 >^^^^
3 > ^
4 > ^^
5 > ^^
6 > ^^^
7 > ^^
8 > ^^
9 > ^^
10> ^
11> ^^->
3 > ^^^^^^^^^
4 > ^
5 > ^^^^^^^->
1->
>
2 >var \
3 > u
4 >
5 > {
6 > 102
7 >
8 > A7
9 > }: string
10> ;
2 >var
3 > \u{102A7}: string
4 > ;
1->Emitted(3, 1) Source(3, 1) + SourceIndex(0)
2 >Emitted(3, 5) Source(3, 6) + SourceIndex(0)
3 >Emitted(3, 6) Source(3, 7) + SourceIndex(0)
4 >Emitted(3, 8) Source(3, 7) + SourceIndex(0)
5 >Emitted(3, 10) Source(3, 8) + SourceIndex(0)
6 >Emitted(3, 13) Source(3, 11) + SourceIndex(0)
7 >Emitted(3, 15) Source(3, 11) + SourceIndex(0)
8 >Emitted(3, 17) Source(3, 13) + SourceIndex(0)
9 >Emitted(3, 19) Source(3, 22) + SourceIndex(0)
10>Emitted(3, 20) Source(3, 23) + SourceIndex(0)
2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0)
3 >Emitted(3, 14) Source(3, 22) + SourceIndex(0)
4 >Emitted(3, 15) Source(3, 23) + SourceIndex(0)
---
>>>if (Math.random()) {
1->
@@ -94,17 +76,23 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts
7 >Emitted(4, 20) Source(5, 20) + SourceIndex(0)
8 >Emitted(4, 21) Source(5, 21) + SourceIndex(0)
---
>>> "hello";
>>> 𐊧 = "hello";
1 >^^^^
2 > ^^^^^^^
3 > ^
2 > ^^
3 > ^^^
4 > ^^^^^^^
5 > ^
1 >
> 𐊧 =
2 > "hello"
3 > ;
1 >Emitted(5, 5) Source(6, 10) + SourceIndex(0)
2 >Emitted(5, 12) Source(6, 17) + SourceIndex(0)
3 >Emitted(5, 13) Source(6, 18) + SourceIndex(0)
>
2 > 𐊧
3 > =
4 > "hello"
5 > ;
1 >Emitted(5, 5) Source(6, 5) + SourceIndex(0)
2 >Emitted(5, 7) Source(6, 7) + SourceIndex(0)
3 >Emitted(5, 10) Source(6, 10) + SourceIndex(0)
4 >Emitted(5, 17) Source(6, 17) + SourceIndex(0)
5 >Emitted(5, 18) Source(6, 18) + SourceIndex(0)
---
>>>}
1 >
@@ -119,75 +107,30 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts
>>>else {
1->^^^^^
2 > ^
3 > ^->
3 > ^^^^^^^^^^^^^^^^^^^->
1->
>else
2 > {
1->Emitted(7, 6) Source(8, 6) + SourceIndex(0)
2 >Emitted(7, 7) Source(8, 7) + SourceIndex(0)
---
>>> u;
>>> \u{102A7} = "hallo";
1->^^^^
2 > ^
3 > ^
2 > ^^^^^^^^^
3 > ^^^
4 > ^^^^^^^
5 > ^
1->
> \
2 > u
3 >
1->Emitted(8, 5) Source(9, 6) + SourceIndex(0)
2 >Emitted(8, 6) Source(9, 7) + SourceIndex(0)
3 >Emitted(8, 7) Source(9, 7) + SourceIndex(0)
---
>>> {
1 >^^^^
2 > ^
3 > ^^^^^^^^->
1 >
2 > {
1 >Emitted(9, 5) Source(9, 7) + SourceIndex(0)
2 >Emitted(9, 6) Source(9, 8) + SourceIndex(0)
---
>>> 102;
1->^^^^^^^^
2 > ^^^
3 > ^
1->
2 > 102
3 >
1->Emitted(10, 9) Source(9, 8) + SourceIndex(0)
2 >Emitted(10, 12) Source(9, 11) + SourceIndex(0)
3 >Emitted(10, 13) Source(9, 11) + SourceIndex(0)
---
>>> A7;
1 >^^^^^^^^
2 > ^^
3 > ^
1 >
2 > A7
3 >
1 >Emitted(11, 9) Source(9, 11) + SourceIndex(0)
2 >Emitted(11, 11) Source(9, 13) + SourceIndex(0)
3 >Emitted(11, 12) Source(9, 13) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
3 > ^^^^^^^^->
1 >
2 > }
1 >Emitted(12, 5) Source(9, 13) + SourceIndex(0)
2 >Emitted(12, 6) Source(9, 14) + SourceIndex(0)
---
>>> "hallo";
1->^^^^
2 > ^^^^^^^
3 > ^
1-> =
2 > "hallo"
3 > ;
1->Emitted(13, 5) Source(9, 17) + SourceIndex(0)
2 >Emitted(13, 12) Source(9, 24) + SourceIndex(0)
3 >Emitted(13, 13) Source(9, 25) + SourceIndex(0)
>
2 > \u{102A7}
3 > =
4 > "hallo"
5 > ;
1->Emitted(8, 5) Source(9, 5) + SourceIndex(0)
2 >Emitted(8, 14) Source(9, 14) + SourceIndex(0)
3 >Emitted(8, 17) Source(9, 17) + SourceIndex(0)
4 >Emitted(8, 24) Source(9, 24) + SourceIndex(0)
5 >Emitted(8, 25) Source(9, 25) + SourceIndex(0)
---
>>>}
1 >
@@ -196,446 +139,192 @@ sourceFile:extendedEscapesForAstralsInVarsAndClasses.ts
1 >
>
2 >}
1 >Emitted(14, 1) Source(10, 1) + SourceIndex(0)
2 >Emitted(14, 2) Source(10, 2) + SourceIndex(0)
1 >Emitted(9, 1) Source(10, 1) + SourceIndex(0)
2 >Emitted(9, 2) Source(10, 2) + SourceIndex(0)
---
>>>class Foo {
1->
2 >^^^^^^
3 > ^^^
4 > ^^^^^^^^^^^->
1->
>
>
2 >class
3 > Foo
1->Emitted(15, 1) Source(12, 1) + SourceIndex(0)
2 >Emitted(15, 7) Source(12, 7) + SourceIndex(0)
3 >Emitted(15, 10) Source(12, 10) + SourceIndex(0)
1->Emitted(10, 1) Source(12, 1) + SourceIndex(0)
2 >Emitted(10, 7) Source(12, 7) + SourceIndex(0)
3 >Emitted(10, 10) Source(12, 10) + SourceIndex(0)
---
>>>}
1 >^
2 > ^->
1 > {
> \u
1 >Emitted(16, 2) Source(13, 7) + SourceIndex(0)
---
>>>{
1->
2 >^
3 > ^^^^^^^^->
1->
2 >{
1->Emitted(17, 1) Source(13, 7) + SourceIndex(0)
2 >Emitted(17, 2) Source(13, 8) + SourceIndex(0)
---
>>> 102;
>>> constructor() {
1->^^^^
2 > ^^^
3 > ^
1->
2 > 102
3 >
1->Emitted(18, 5) Source(13, 8) + SourceIndex(0)
2 >Emitted(18, 8) Source(13, 11) + SourceIndex(0)
3 >Emitted(18, 9) Source(13, 11) + SourceIndex(0)
---
>>> A7;
1 >^^^^
2 > ^^
3 > ^
1 >
2 > A7
3 >
1 >Emitted(19, 5) Source(13, 11) + SourceIndex(0)
2 >Emitted(19, 7) Source(13, 13) + SourceIndex(0)
3 >Emitted(19, 8) Source(13, 13) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^->
1 >
2 >}
1 >Emitted(20, 1) Source(13, 13) + SourceIndex(0)
2 >Emitted(20, 2) Source(13, 14) + SourceIndex(0)
---
>>>string;
1->
2 >^^^^^^
3 > ^
4 > ^^^^^^^^->
1->:
2 >string
3 > ;
1->Emitted(21, 1) Source(13, 16) + SourceIndex(0)
2 >Emitted(21, 7) Source(13, 22) + SourceIndex(0)
3 >Emitted(21, 8) Source(13, 23) + SourceIndex(0)
---
>>>constructor();
1->
2 >^^^^^^^^^^^
3 > ^^
4 > ^
1->
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1-> {
> \u{102A7}: string;
>
2 >constructor
3 > ()
4 >
1->Emitted(22, 1) Source(14, 5) + SourceIndex(0)
2 >Emitted(22, 12) Source(14, 16) + SourceIndex(0)
3 >Emitted(22, 14) Source(14, 18) + SourceIndex(0)
4 >Emitted(22, 15) Source(14, 18) + SourceIndex(0)
1->Emitted(11, 5) Source(14, 5) + SourceIndex(0)
---
>>>{
1 >
2 >^
3 > ^^^^^^^^^^->
1 >
2 >{
1 >Emitted(23, 1) Source(14, 19) + SourceIndex(0)
2 >Emitted(23, 2) Source(14, 20) + SourceIndex(0)
---
>>> this.;
1->^^^^
2 > ^^^^
3 > ^
4 > ^
1->
>
2 > this
3 > .
4 >
1->Emitted(24, 5) Source(15, 9) + SourceIndex(0)
2 >Emitted(24, 9) Source(15, 13) + SourceIndex(0)
3 >Emitted(24, 10) Source(15, 14) + SourceIndex(0)
4 >Emitted(24, 11) Source(15, 14) + SourceIndex(0)
---
>>> u;
1 >^^^^
2 > ^
3 > ^
1 >\
2 > u
3 >
1 >Emitted(25, 5) Source(15, 15) + SourceIndex(0)
2 >Emitted(25, 6) Source(15, 16) + SourceIndex(0)
3 >Emitted(25, 7) Source(15, 16) + SourceIndex(0)
---
>>> {
1 >^^^^
2 > ^
3 > ^^^^^^^^->
1 >
2 > {
1 >Emitted(26, 5) Source(15, 16) + SourceIndex(0)
2 >Emitted(26, 6) Source(15, 17) + SourceIndex(0)
---
>>> 102;
>>> this.\u{102A7} = " world";
1->^^^^^^^^
2 > ^^^
3 > ^
1->
2 > 102
3 >
1->Emitted(27, 9) Source(15, 17) + SourceIndex(0)
2 >Emitted(27, 12) Source(15, 20) + SourceIndex(0)
3 >Emitted(27, 13) Source(15, 20) + SourceIndex(0)
---
>>> A7;
1 >^^^^^^^^
2 > ^^
3 > ^
1 >
2 > A7
3 >
1 >Emitted(28, 9) Source(15, 20) + SourceIndex(0)
2 >Emitted(28, 11) Source(15, 22) + SourceIndex(0)
3 >Emitted(28, 12) Source(15, 22) + SourceIndex(0)
2 > ^^^^
3 > ^
4 > ^^^^^^^^^
5 > ^^^
6 > ^^^^^^^^
7 > ^
1->constructor() {
>
2 > this
3 > .
4 > \u{102A7}
5 > =
6 > " world"
7 > ;
1->Emitted(12, 9) Source(15, 9) + SourceIndex(0)
2 >Emitted(12, 13) Source(15, 13) + SourceIndex(0)
3 >Emitted(12, 14) Source(15, 14) + SourceIndex(0)
4 >Emitted(12, 23) Source(15, 23) + SourceIndex(0)
5 >Emitted(12, 26) Source(15, 26) + SourceIndex(0)
6 >Emitted(12, 34) Source(15, 34) + SourceIndex(0)
7 >Emitted(12, 35) Source(15, 35) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
2 > }
1 >Emitted(29, 5) Source(15, 22) + SourceIndex(0)
2 >Emitted(29, 6) Source(15, 23) + SourceIndex(0)
---
>>> " world";
1->^^^^
2 > ^^^^^^^^
3 > ^
1-> =
2 > " world"
3 > ;
1->Emitted(30, 5) Source(15, 26) + SourceIndex(0)
2 >Emitted(30, 13) Source(15, 34) + SourceIndex(0)
3 >Emitted(30, 14) Source(15, 35) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^->
3 > ^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(31, 1) Source(16, 5) + SourceIndex(0)
2 >Emitted(31, 2) Source(16, 6) + SourceIndex(0)
2 > }
1 >Emitted(13, 5) Source(16, 5) + SourceIndex(0)
2 >Emitted(13, 6) Source(16, 6) + SourceIndex(0)
---
>>>methodA();
1->
2 >^^^^^^^
3 > ^^
4 > ^
1->
>
2 >methodA
3 > ()
4 >
1->Emitted(32, 1) Source(17, 5) + SourceIndex(0)
2 >Emitted(32, 8) Source(17, 12) + SourceIndex(0)
3 >Emitted(32, 10) Source(17, 14) + SourceIndex(0)
4 >Emitted(32, 11) Source(17, 14) + SourceIndex(0)
---
>>>{
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^->
1 >
2 >{
1 >Emitted(33, 1) Source(17, 15) + SourceIndex(0)
2 >Emitted(33, 2) Source(17, 16) + SourceIndex(0)
---
>>> return this.𐊧;
>>> methodA() {
1->^^^^
2 > ^^^^^^^
3 > ^^^^
4 > ^
5 > ^^
6 > ^
3 > ^^^^^^^^^^^^^->
1->
>
2 > return
3 > this
4 > .
5 > 𐊧
6 > ;
1->Emitted(34, 5) Source(18, 9) + SourceIndex(0)
2 >Emitted(34, 12) Source(18, 16) + SourceIndex(0)
3 >Emitted(34, 16) Source(18, 20) + SourceIndex(0)
4 >Emitted(34, 17) Source(18, 21) + SourceIndex(0)
5 >Emitted(34, 19) Source(18, 23) + SourceIndex(0)
6 >Emitted(34, 20) Source(18, 24) + SourceIndex(0)
>
2 > methodA
1->Emitted(14, 5) Source(17, 5) + SourceIndex(0)
2 >Emitted(14, 12) Source(17, 12) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^->
>>> return this.𐊧;
1->^^^^^^^^
2 > ^^^^^^^
3 > ^^^^
4 > ^
5 > ^^
6 > ^
1->() {
>
2 > return
3 > this
4 > .
5 > 𐊧
6 > ;
1->Emitted(15, 9) Source(18, 9) + SourceIndex(0)
2 >Emitted(15, 16) Source(18, 16) + SourceIndex(0)
3 >Emitted(15, 20) Source(18, 20) + SourceIndex(0)
4 >Emitted(15, 21) Source(18, 21) + SourceIndex(0)
5 >Emitted(15, 23) Source(18, 23) + SourceIndex(0)
6 >Emitted(15, 24) Source(18, 24) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 >}
1 >Emitted(35, 1) Source(19, 5) + SourceIndex(0)
2 >Emitted(35, 2) Source(19, 6) + SourceIndex(0)
2 > }
1 >Emitted(16, 5) Source(19, 5) + SourceIndex(0)
2 >Emitted(16, 6) Source(19, 6) + SourceIndex(0)
---
>>>export var _;
>>>}
1 >^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>}
1 >Emitted(17, 2) Source(20, 2) + SourceIndex(0)
---
>>>export var _𐊧 = new Foo().\u{102A7} + new Foo().methodA();
1->
2 >^^^^^^
3 > ^
4 > ^^^^
5 > ^
6 > ^
5 > ^^^
6 > ^^^
7 > ^^^^
8 > ^^^
9 > ^^
10> ^
11> ^^^^^^^^^
12> ^^^
13> ^^^^
14> ^^^
15> ^^
16> ^
17> ^^^^^^^
18> ^^
19> ^
1->
>}
>
>
2 >export
3 >
4 > var
5 > _𐊧 =
6 >
1->Emitted(36, 1) Source(22, 1) + SourceIndex(0)
2 >Emitted(36, 7) Source(22, 7) + SourceIndex(0)
3 >Emitted(36, 8) Source(22, 8) + SourceIndex(0)
4 >Emitted(36, 12) Source(22, 12) + SourceIndex(0)
5 >Emitted(36, 13) Source(22, 17) + SourceIndex(0)
6 >Emitted(36, 14) Source(22, 17) + SourceIndex(0)
5 > _𐊧
6 > =
7 > new
8 > Foo
9 > ()
10> .
11> \u{102A7}
12> +
13> new
14> Foo
15> ()
16> .
17> methodA
18> ()
19> ;
1->Emitted(18, 1) Source(22, 1) + SourceIndex(0)
2 >Emitted(18, 7) Source(22, 7) + SourceIndex(0)
3 >Emitted(18, 8) Source(22, 8) + SourceIndex(0)
4 >Emitted(18, 12) Source(22, 12) + SourceIndex(0)
5 >Emitted(18, 15) Source(22, 15) + SourceIndex(0)
6 >Emitted(18, 18) Source(22, 18) + SourceIndex(0)
7 >Emitted(18, 22) Source(22, 22) + SourceIndex(0)
8 >Emitted(18, 25) Source(22, 25) + SourceIndex(0)
9 >Emitted(18, 27) Source(22, 27) + SourceIndex(0)
10>Emitted(18, 28) Source(22, 28) + SourceIndex(0)
11>Emitted(18, 37) Source(22, 37) + SourceIndex(0)
12>Emitted(18, 40) Source(22, 40) + SourceIndex(0)
13>Emitted(18, 44) Source(22, 44) + SourceIndex(0)
14>Emitted(18, 47) Source(22, 47) + SourceIndex(0)
15>Emitted(18, 49) Source(22, 49) + SourceIndex(0)
16>Emitted(18, 50) Source(22, 50) + SourceIndex(0)
17>Emitted(18, 57) Source(22, 57) + SourceIndex(0)
18>Emitted(18, 59) Source(22, 59) + SourceIndex(0)
19>Emitted(18, 60) Source(22, 60) + SourceIndex(0)
---
>>>new Foo().;
>>>_\u{102A7} += "!";
1 >
2 >^^^^
3 > ^^^
4 > ^^
5 > ^
6 > ^
1 >
2 >new
3 > Foo
4 > ()
5 > .
6 >
1 >Emitted(37, 1) Source(22, 18) + SourceIndex(0)
2 >Emitted(37, 5) Source(22, 22) + SourceIndex(0)
3 >Emitted(37, 8) Source(22, 25) + SourceIndex(0)
4 >Emitted(37, 10) Source(22, 27) + SourceIndex(0)
5 >Emitted(37, 11) Source(22, 28) + SourceIndex(0)
6 >Emitted(37, 12) Source(22, 28) + SourceIndex(0)
---
>>>u;
1 >
2 >^
3 > ^
1 >\
2 >u
3 >
1 >Emitted(38, 1) Source(22, 29) + SourceIndex(0)
2 >Emitted(38, 2) Source(22, 30) + SourceIndex(0)
3 >Emitted(38, 3) Source(22, 30) + SourceIndex(0)
---
>>>{
1 >
2 >^
3 > ^^^^^^^^->
1 >
2 >{
1 >Emitted(39, 1) Source(22, 30) + SourceIndex(0)
2 >Emitted(39, 2) Source(22, 31) + SourceIndex(0)
---
>>> 102;
1->^^^^
2 > ^^^
3 > ^
1->
2 > 102
3 >
1->Emitted(40, 5) Source(22, 31) + SourceIndex(0)
2 >Emitted(40, 8) Source(22, 34) + SourceIndex(0)
3 >Emitted(40, 9) Source(22, 34) + SourceIndex(0)
---
>>> A7;
1 >^^^^
2 > ^^
3 > ^
1 >
2 > A7
3 >
1 >Emitted(41, 5) Source(22, 34) + SourceIndex(0)
2 >Emitted(41, 7) Source(22, 36) + SourceIndex(0)
3 >Emitted(41, 8) Source(22, 36) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
1 >Emitted(42, 1) Source(22, 36) + SourceIndex(0)
2 >Emitted(42, 2) Source(22, 37) + SourceIndex(0)
---
>>>+new Foo().methodA();
1->
2 >^
3 > ^^^^
4 > ^^^
5 > ^^
6 > ^
7 > ^^^^^^^
8 > ^^
9 > ^
1->
2 >+
3 > new
4 > Foo
5 > ()
6 > .
7 > methodA
8 > ()
9 > ;
1->Emitted(43, 1) Source(22, 38) + SourceIndex(0)
2 >Emitted(43, 2) Source(22, 40) + SourceIndex(0)
3 >Emitted(43, 6) Source(22, 44) + SourceIndex(0)
4 >Emitted(43, 9) Source(22, 47) + SourceIndex(0)
5 >Emitted(43, 11) Source(22, 49) + SourceIndex(0)
6 >Emitted(43, 12) Source(22, 50) + SourceIndex(0)
7 >Emitted(43, 19) Source(22, 57) + SourceIndex(0)
8 >Emitted(43, 21) Source(22, 59) + SourceIndex(0)
9 >Emitted(43, 22) Source(22, 60) + SourceIndex(0)
---
>>>_;
1 >
2 >^
3 > ^
4 > ^->
2 >^^^^^^^^^^
3 > ^^^^
4 > ^^^
5 > ^
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
>
2 >_
3 >
1 >Emitted(44, 1) Source(24, 1) + SourceIndex(0)
2 >Emitted(44, 2) Source(24, 2) + SourceIndex(0)
3 >Emitted(44, 3) Source(24, 2) + SourceIndex(0)
---
>>>u;
1->
2 >^
3 > ^
1->\
2 >u
3 >
1->Emitted(45, 1) Source(24, 3) + SourceIndex(0)
2 >Emitted(45, 2) Source(24, 4) + SourceIndex(0)
3 >Emitted(45, 3) Source(24, 4) + SourceIndex(0)
---
>>>{
1 >
2 >^
3 > ^^^^^^^^->
1 >
2 >{
1 >Emitted(46, 1) Source(24, 4) + SourceIndex(0)
2 >Emitted(46, 2) Source(24, 5) + SourceIndex(0)
---
>>> 102;
1->^^^^
2 > ^^^
3 > ^
1->
2 > 102
3 >
1->Emitted(47, 5) Source(24, 5) + SourceIndex(0)
2 >Emitted(47, 8) Source(24, 8) + SourceIndex(0)
3 >Emitted(47, 9) Source(24, 8) + SourceIndex(0)
---
>>> A7;
1 >^^^^
2 > ^^
3 > ^
1 >
2 > A7
3 >
1 >Emitted(48, 5) Source(24, 8) + SourceIndex(0)
2 >Emitted(48, 7) Source(24, 10) + SourceIndex(0)
3 >Emitted(48, 8) Source(24, 10) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^->
1 >
2 >}
1 >Emitted(49, 1) Source(24, 10) + SourceIndex(0)
2 >Emitted(49, 2) Source(24, 11) + SourceIndex(0)
---
>>>"!";
1->
2 >^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1-> +=
2 >"!"
3 > ;
1->Emitted(50, 1) Source(24, 15) + SourceIndex(0)
2 >Emitted(50, 4) Source(24, 18) + SourceIndex(0)
3 >Emitted(50, 5) Source(24, 19) + SourceIndex(0)
2 >_\u{102A7}
3 > +=
4 > "!"
5 > ;
1 >Emitted(19, 1) Source(24, 1) + SourceIndex(0)
2 >Emitted(19, 11) Source(24, 11) + SourceIndex(0)
3 >Emitted(19, 15) Source(24, 15) + SourceIndex(0)
4 >Emitted(19, 18) Source(24, 18) + SourceIndex(0)
5 >Emitted(19, 19) Source(24, 19) + SourceIndex(0)
---
>>>//# sourceMappingURL=extendedEscapesForAstralsInVarsAndClasses.js.map===================================================================
JsFile: astralAsSurrogatePair.js
@@ -3,11 +3,10 @@
=== extendedEscapesForAstralsInVarsAndClasses.ts ===
// U+102A7 CARIAN LETTER A2
var 𐊧: string;
>string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 7))
>𐊧 : Symbol(𐊧, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3))
var \u{102A7}: string;
>u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5))
>A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7))
>\u{102A7} : Symbol(𐊧, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3))
if (Math.random()) {
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
@@ -15,47 +14,51 @@ if (Math.random()) {
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
𐊧 = "hello";
>𐊧 : Symbol(𐊧, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3))
}
else {
\u{102A7} = "hallo";
>u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5))
>A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7))
>\u{102A7} : Symbol(𐊧, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 3), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 3))
}
class Foo {
>Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1))
\u{102A7}: string;
>u : Symbol(Foo.u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 12, 5))
>A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7))
>string : Symbol(string, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 1, 7))
>\u{102A7} : Symbol(Foo[\u{102A7}], Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11))
constructor() {
this.\u{102A7} = " world";
>u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5))
>A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7))
>this.\u{102A7} : Symbol(Foo[\u{102A7}], Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11))
>this : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1))
>\u{102A7} : Symbol(Foo[\u{102A7}], Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11))
}
methodA() {
>methodA : Symbol(Foo.methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5))
return this.𐊧;
>this.𐊧 : Symbol(Foo[\u{102A7}], Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11))
>this : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1))
>𐊧 : Symbol(Foo[\u{102A7}], Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11))
}
}
export var _𐊧 = new Foo().\u{102A7} + new Foo().methodA();
>_ : Symbol(_, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10))
>_𐊧 : Symbol(_𐊧, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10))
>new Foo().\u{102A7} : Symbol(Foo[\u{102A7}], Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11))
>Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1))
>u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5))
>A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7))
>\u{102A7} : Symbol(Foo[\u{102A7}], Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 11, 11))
>new Foo().methodA : Symbol(Foo.methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5))
>Foo : Symbol(Foo, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 9, 1))
>methodA : Symbol(Foo.methodA, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 15, 5))
_\u{102A7} += "!";
>_ : Symbol(_, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10))
>u : Symbol(u, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 5))
>A7 : Symbol(A7, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 2, 7))
>_\u{102A7} : Symbol(_𐊧, Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10))
=== astralAsSurrogatePair.ts ===
import { _𐊧 as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js";
>_ : Symbol(_, Decl(astralAsSurrogatePair.ts, 0, 8))
>as : Symbol(as, Decl(astralAsSurrogatePair.ts, 0, 12))
>_𐊧 : Symbol((Missing), Decl(extendedEscapesForAstralsInVarsAndClasses.ts, 21, 10))
> : Symbol((Missing), Decl(astralAsSurrogatePair.ts, 0, 8))
>uD800 : Symbol(uD800, Decl(astralAsSurrogatePair.ts, 0, 17))
>uDEA7 : Symbol(uDEA7, Decl(astralAsSurrogatePair.ts, 0, 23))
@@ -3,14 +3,12 @@
=== extendedEscapesForAstralsInVarsAndClasses.ts ===
// U+102A7 CARIAN LETTER A2
var 𐊧: string;
>string : any
> : ^^^
>𐊧 : string
> : ^^^^^^
var \u{102A7}: string;
>u : any
> : ^^^
>A7 : string
> : ^^^^^^
>\u{102A7} : string
> : ^^^^^^
if (Math.random()) {
>Math.random() : number
@@ -23,17 +21,19 @@ if (Math.random()) {
> : ^^^^^^
𐊧 = "hello";
>𐊧 = "hello" : "hello"
> : ^^^^^^^
>𐊧 : string
> : ^^^^^^
>"hello" : "hello"
> : ^^^^^^^
}
else {
\u{102A7} = "hallo";
>u : any
> : ^^^
>102 : 102
> : ^^^
>A7 : string
> : ^^^^^^
>\u{102A7} = "hallo" : "hallo"
> : ^^^^^^^
>\u{102A7} : string
> : ^^^^^^
>"hallo" : "hallo"
> : ^^^^^^^
}
@@ -43,101 +43,74 @@ class Foo {
> : ^^^
\u{102A7}: string;
>u : any
> : ^^^
>102 : 102
> : ^^^
>A7 : string
> : ^^^^^^
>string : any
> : ^^^
>\u{102A7} : string
> : ^^^^^^
constructor() {
>constructor() : any
> : ^^^
>constructor : any
> : ^^^
this.\u{102A7} = " world";
>this. : any
> : ^^^
>this : undefined
> : ^^^^^^^^^
> : any
> : ^^^
>u : any
> : ^^^
>102 : 102
> : ^^^
>A7 : string
> : ^^^^^^
>this.\u{102A7} = " world" : " world"
> : ^^^^^^^^
>this.\u{102A7} : string
> : ^^^^^^
>this : this
> : ^^^^
>\u{102A7} : string
> : ^^^^^^
>" world" : " world"
> : ^^^^^^^^
}
methodA() {
>methodA() : any
> : ^^^
>methodA : any
> : ^^^
>methodA : () => string
> : ^^^^^^^^^^^^
return this.𐊧;
>this.𐊧 : any
> : ^^^
>this : undefined
> : ^^^^^^^^^
>𐊧 : any
> : ^^^
>this.𐊧 : string
> : ^^^^^^
>this : this
> : ^^^^
>𐊧 : string
> : ^^^^^^
}
}
export var _𐊧 = new Foo().\u{102A7} + new Foo().methodA();
>_ : any
> : ^^^
>new Foo(). : any
> : ^^^
>_𐊧 : string
> : ^^^^^^
>new Foo().\u{102A7} + new Foo().methodA() : string
> : ^^^^^^
>new Foo().\u{102A7} : string
> : ^^^^^^
>new Foo() : Foo
> : ^^^
>Foo : typeof Foo
> : ^^^^^^^^^^
> : any
> : ^^^
>u : any
> : ^^^
>102 : 102
> : ^^^
>A7 : string
> : ^^^^^^
>+ new Foo().methodA() : number
> : ^^^^^^
>new Foo().methodA() : any
> : ^^^
>new Foo().methodA : any
> : ^^^
>\u{102A7} : string
> : ^^^^^^
>new Foo().methodA() : string
> : ^^^^^^
>new Foo().methodA : () => string
> : ^^^^^^^^^^^^
>new Foo() : Foo
> : ^^^
>Foo : typeof Foo
> : ^^^^^^^^^^
>methodA : any
> : ^^^
>methodA : () => string
> : ^^^^^^^^^^^^
_\u{102A7} += "!";
>_ : any
> : ^^^
>u : any
> : ^^^
>102 : 102
> : ^^^
>A7 : string
> : ^^^^^^
>_\u{102A7} += "!" : string
> : ^^^^^^
>_\u{102A7} : string
> : ^^^^^^
>"!" : "!"
> : ^^^
=== astralAsSurrogatePair.ts ===
import { _𐊧 as \uD800\uDEA7 } from "./extendedEscapesForAstralsInVarsAndClasses.js";
>_ : any
> : ^^^
>as : any
> : ^^^
>_𐊧 : string
> : ^^^^^^
> : string
> : ^^^^^^
>uD800 : any
> : ^^^
>uDEA7 : any