fix kit position

Issue: https://gitee.com/openharmony/third_party_typescript/issues/IAWXJF

Signed-off-by: liyancheng2 <liyancheng2@huawei.com>

Change-Id: I52c0925e3efaa0312ed2df436a34e91680f25be1
This commit is contained in:
liyancheng2 2024-09-04 23:44:34 +08:00
parent 3b10398d5f
commit 874343083c
9 changed files with 157 additions and 140 deletions

View File

@ -12180,7 +12180,7 @@ var ts;
}
ts.Debug.assert(!ts.isJSDoc(errorNode));
var isMissing = nodeIsMissing(errorNode);
var pos = isMissing || ts.isJsxText(node) || node.virtual
var pos = isMissing || ts.isJsxText(node) || (node.virtual && !(node.flags & 536870912))
? errorNode.pos
: ts.skipTrivia(sourceFile.text, errorNode.pos);
if (isMissing) {
@ -39321,43 +39321,42 @@ var ts;
kitJsonCache === null || kitJsonCache === void 0 ? void 0 : kitJsonCache.clear();
}
ts.cleanKitJsonCache = cleanKitJsonCache;
function setVirtualNode(node, start, end) {
function setVirtualNodeAndKitImportFlags(node, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = 0; }
node.virtual = true;
ts.setTextRangePosEnd(node, start, end);
node.flags |= 536870912;
return node;
}
function setNoOriginalText(node) {
node.flags |= -2147483648;
return node;
}
function createNameImportDeclaration(factory, isType, name, source, oldStatement) {
function createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause;
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNode(factory.createImportClause(isType, name, undefined), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, name, undefined), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement) {
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause;
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNode(factory.createIdentifier(propname), name.pos, name.end));
var newImportSpecific = setVirtualNode(factory.createImportSpecifier(false, newPropertyName, name), oldImportClause.pos, oldImportClause.end);
var newNamedBindings = setVirtualNode(factory.createNamedImports([newImportSpecific]), oldImportClause.pos, oldImportClause.end);
var newImportClause = setVirtualNode(factory.createImportClause(isType, undefined, newNamedBindings), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createIdentifier(propname), name.pos, name.end));
var newImportSpecific = setVirtualNodeAndKitImportFlags(factory.createImportSpecifier(false, newPropertyName, name), importSpecifier.pos, importSpecifier.end);
var newNamedBindings = setVirtualNodeAndKitImportFlags(factory.createNamedImports([newImportSpecific]), importSpecifier.pos, importSpecifier.end);
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, undefined, newNamedBindings), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement) {
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement, importSpecifier) {
var source = symbol.source.replace(/\.d.[e]?ts$/, '');
var binding = symbol.bindings;
if (binding === DEFAULT_KEYWORD) {
return createNameImportDeclaration(factory, isType, name, source, oldStatement);
return createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier);
}
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement);
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement, importSpecifier);
}
function markKitImport(statement, markedkitImportRanges) {
markedkitImportRanges.push({ pos: statement.pos, end: statement.end });
@ -39417,7 +39416,7 @@ var ts;
if (!symbol || (!inEtsContext && symbol.source.endsWith(ETS_DECLARATION))) {
return false;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement, importClause.name));
}
if (importClause.namedBindings) {
var hasError_1 = false;
@ -39438,7 +39437,7 @@ var ts;
hasError_1 = true;
return;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement, element));
});
if (hasError_1) {
return false;

View File

@ -4626,6 +4626,7 @@ var ts;
NodeFlags[NodeFlags["JsonFile"] = 67108864] = "JsonFile";
/* @internal */ NodeFlags[NodeFlags["TypeCached"] = 134217728] = "TypeCached";
/* @internal */ NodeFlags[NodeFlags["Deprecated"] = 268435456] = "Deprecated";
/* @internal */ NodeFlags[NodeFlags["KitImportFlags"] = 536870912] = "KitImportFlags";
NodeFlags[NodeFlags["EtsContext"] = 1073741824] = "EtsContext";
/* @internal */ NodeFlags[NodeFlags["NoOriginalText"] = -2147483648] = "NoOriginalText";
NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
@ -15812,7 +15813,7 @@ var ts;
}
ts.Debug.assert(!ts.isJSDoc(errorNode));
var isMissing = nodeIsMissing(errorNode);
var pos = isMissing || ts.isJsxText(node) || node.virtual
var pos = isMissing || ts.isJsxText(node) || (node.virtual && !(node.flags & 536870912 /* NodeFlags.KitImportFlags */))
? errorNode.pos
: ts.skipTrivia(sourceFile.text, errorNode.pos);
// These asserts should all be satisfied for a properly constructed `errorNode`.
@ -47734,43 +47735,45 @@ var ts;
kitJsonCache === null || kitJsonCache === void 0 ? void 0 : kitJsonCache.clear();
}
ts.cleanKitJsonCache = cleanKitJsonCache;
function setVirtualNode(node, start, end) {
function setVirtualNodeAndKitImportFlags(node, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = 0; }
node.virtual = true;
ts.setTextRangePosEnd(node, start, end);
node.flags |= 536870912 /* NodeFlags.KitImportFlags */;
return node;
}
function setNoOriginalText(node) {
node.flags |= -2147483648 /* NodeFlags.NoOriginalText */;
return node;
}
function createNameImportDeclaration(factory, isType, name, source, oldStatement) {
function createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNode(factory.createImportClause(isType, name, undefined), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, name, undefined), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement) {
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNode(factory.createIdentifier(propname), name.pos, name.end));
var newImportSpecific = setVirtualNode(factory.createImportSpecifier(false, newPropertyName, name), oldImportClause.pos, oldImportClause.end);
var newNamedBindings = setVirtualNode(factory.createNamedImports([newImportSpecific]), oldImportClause.pos, oldImportClause.end);
var newImportClause = setVirtualNode(factory.createImportClause(isType, undefined, newNamedBindings), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createIdentifier(propname), name.pos, name.end));
// The location information of the newImportSpecific is created using the location information of the old importSpecifier.
var newImportSpecific = setVirtualNodeAndKitImportFlags(factory.createImportSpecifier(false, newPropertyName, name), importSpecifier.pos, importSpecifier.end);
// The location information of the newNamedBindings is created using the location information of the old importSpecifier.
var newNamedBindings = setVirtualNodeAndKitImportFlags(factory.createNamedImports([newImportSpecific]), importSpecifier.pos, importSpecifier.end);
// The location information of the newImportClause is created using the location information of the old importSpecifier.
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, undefined, newNamedBindings), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement) {
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement, importSpecifier) {
var source = symbol.source.replace(/\.d.[e]?ts$/, '');
var binding = symbol.bindings;
if (binding === DEFAULT_KEYWORD) {
return createNameImportDeclaration(factory, isType, name, source, oldStatement);
return createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier);
}
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement);
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement, importSpecifier);
}
function markKitImport(statement, markedkitImportRanges) {
markedkitImportRanges.push({ pos: statement.pos, end: statement.end });
@ -47835,7 +47838,7 @@ var ts;
if (!symbol || (!inEtsContext && symbol.source.endsWith(ETS_DECLARATION))) {
return false;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement, importClause.name));
}
if (importClause.namedBindings) {
var hasError_1 = false;
@ -47858,7 +47861,7 @@ var ts;
hasError_1 = true;
return;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement, element));
});
if (hasError_1) {
return false;

View File

@ -4625,6 +4625,7 @@ var ts;
NodeFlags[NodeFlags["JsonFile"] = 67108864] = "JsonFile";
/* @internal */ NodeFlags[NodeFlags["TypeCached"] = 134217728] = "TypeCached";
/* @internal */ NodeFlags[NodeFlags["Deprecated"] = 268435456] = "Deprecated";
/* @internal */ NodeFlags[NodeFlags["KitImportFlags"] = 536870912] = "KitImportFlags";
NodeFlags[NodeFlags["EtsContext"] = 1073741824] = "EtsContext";
/* @internal */ NodeFlags[NodeFlags["NoOriginalText"] = -2147483648] = "NoOriginalText";
NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
@ -15811,7 +15812,7 @@ var ts;
}
ts.Debug.assert(!ts.isJSDoc(errorNode));
var isMissing = nodeIsMissing(errorNode);
var pos = isMissing || ts.isJsxText(node) || node.virtual
var pos = isMissing || ts.isJsxText(node) || (node.virtual && !(node.flags & 536870912 /* NodeFlags.KitImportFlags */))
? errorNode.pos
: ts.skipTrivia(sourceFile.text, errorNode.pos);
// These asserts should all be satisfied for a properly constructed `errorNode`.
@ -47733,43 +47734,45 @@ var ts;
kitJsonCache === null || kitJsonCache === void 0 ? void 0 : kitJsonCache.clear();
}
ts.cleanKitJsonCache = cleanKitJsonCache;
function setVirtualNode(node, start, end) {
function setVirtualNodeAndKitImportFlags(node, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = 0; }
node.virtual = true;
ts.setTextRangePosEnd(node, start, end);
node.flags |= 536870912 /* NodeFlags.KitImportFlags */;
return node;
}
function setNoOriginalText(node) {
node.flags |= -2147483648 /* NodeFlags.NoOriginalText */;
return node;
}
function createNameImportDeclaration(factory, isType, name, source, oldStatement) {
function createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNode(factory.createImportClause(isType, name, undefined), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, name, undefined), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement) {
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNode(factory.createIdentifier(propname), name.pos, name.end));
var newImportSpecific = setVirtualNode(factory.createImportSpecifier(false, newPropertyName, name), oldImportClause.pos, oldImportClause.end);
var newNamedBindings = setVirtualNode(factory.createNamedImports([newImportSpecific]), oldImportClause.pos, oldImportClause.end);
var newImportClause = setVirtualNode(factory.createImportClause(isType, undefined, newNamedBindings), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createIdentifier(propname), name.pos, name.end));
// The location information of the newImportSpecific is created using the location information of the old importSpecifier.
var newImportSpecific = setVirtualNodeAndKitImportFlags(factory.createImportSpecifier(false, newPropertyName, name), importSpecifier.pos, importSpecifier.end);
// The location information of the newNamedBindings is created using the location information of the old importSpecifier.
var newNamedBindings = setVirtualNodeAndKitImportFlags(factory.createNamedImports([newImportSpecific]), importSpecifier.pos, importSpecifier.end);
// The location information of the newImportClause is created using the location information of the old importSpecifier.
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, undefined, newNamedBindings), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement) {
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement, importSpecifier) {
var source = symbol.source.replace(/\.d.[e]?ts$/, '');
var binding = symbol.bindings;
if (binding === DEFAULT_KEYWORD) {
return createNameImportDeclaration(factory, isType, name, source, oldStatement);
return createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier);
}
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement);
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement, importSpecifier);
}
function markKitImport(statement, markedkitImportRanges) {
markedkitImportRanges.push({ pos: statement.pos, end: statement.end });
@ -47834,7 +47837,7 @@ var ts;
if (!symbol || (!inEtsContext && symbol.source.endsWith(ETS_DECLARATION))) {
return false;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement, importClause.name));
}
if (importClause.namedBindings) {
var hasError_1 = false;
@ -47857,7 +47860,7 @@ var ts;
hasError_1 = true;
return;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement, element));
});
if (hasError_1) {
return false;

View File

@ -4616,6 +4616,7 @@ var ts;
NodeFlags[NodeFlags["JsonFile"] = 67108864] = "JsonFile";
/* @internal */ NodeFlags[NodeFlags["TypeCached"] = 134217728] = "TypeCached";
/* @internal */ NodeFlags[NodeFlags["Deprecated"] = 268435456] = "Deprecated";
/* @internal */ NodeFlags[NodeFlags["KitImportFlags"] = 536870912] = "KitImportFlags";
NodeFlags[NodeFlags["EtsContext"] = 1073741824] = "EtsContext";
/* @internal */ NodeFlags[NodeFlags["NoOriginalText"] = -2147483648] = "NoOriginalText";
NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
@ -15802,7 +15803,7 @@ var ts;
}
ts.Debug.assert(!ts.isJSDoc(errorNode));
var isMissing = nodeIsMissing(errorNode);
var pos = isMissing || ts.isJsxText(node) || node.virtual
var pos = isMissing || ts.isJsxText(node) || (node.virtual && !(node.flags & 536870912 /* NodeFlags.KitImportFlags */))
? errorNode.pos
: ts.skipTrivia(sourceFile.text, errorNode.pos);
// These asserts should all be satisfied for a properly constructed `errorNode`.
@ -47724,43 +47725,45 @@ var ts;
kitJsonCache === null || kitJsonCache === void 0 ? void 0 : kitJsonCache.clear();
}
ts.cleanKitJsonCache = cleanKitJsonCache;
function setVirtualNode(node, start, end) {
function setVirtualNodeAndKitImportFlags(node, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = 0; }
node.virtual = true;
ts.setTextRangePosEnd(node, start, end);
node.flags |= 536870912 /* NodeFlags.KitImportFlags */;
return node;
}
function setNoOriginalText(node) {
node.flags |= -2147483648 /* NodeFlags.NoOriginalText */;
return node;
}
function createNameImportDeclaration(factory, isType, name, source, oldStatement) {
function createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNode(factory.createImportClause(isType, name, undefined), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, name, undefined), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement) {
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNode(factory.createIdentifier(propname), name.pos, name.end));
var newImportSpecific = setVirtualNode(factory.createImportSpecifier(false, newPropertyName, name), oldImportClause.pos, oldImportClause.end);
var newNamedBindings = setVirtualNode(factory.createNamedImports([newImportSpecific]), oldImportClause.pos, oldImportClause.end);
var newImportClause = setVirtualNode(factory.createImportClause(isType, undefined, newNamedBindings), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createIdentifier(propname), name.pos, name.end));
// The location information of the newImportSpecific is created using the location information of the old importSpecifier.
var newImportSpecific = setVirtualNodeAndKitImportFlags(factory.createImportSpecifier(false, newPropertyName, name), importSpecifier.pos, importSpecifier.end);
// The location information of the newNamedBindings is created using the location information of the old importSpecifier.
var newNamedBindings = setVirtualNodeAndKitImportFlags(factory.createNamedImports([newImportSpecific]), importSpecifier.pos, importSpecifier.end);
// The location information of the newImportClause is created using the location information of the old importSpecifier.
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, undefined, newNamedBindings), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement) {
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement, importSpecifier) {
var source = symbol.source.replace(/\.d.[e]?ts$/, '');
var binding = symbol.bindings;
if (binding === DEFAULT_KEYWORD) {
return createNameImportDeclaration(factory, isType, name, source, oldStatement);
return createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier);
}
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement);
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement, importSpecifier);
}
function markKitImport(statement, markedkitImportRanges) {
markedkitImportRanges.push({ pos: statement.pos, end: statement.end });
@ -47825,7 +47828,7 @@ var ts;
if (!symbol || (!inEtsContext && symbol.source.endsWith(ETS_DECLARATION))) {
return false;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement, importClause.name));
}
if (importClause.namedBindings) {
var hasError_1 = false;
@ -47848,7 +47851,7 @@ var ts;
hasError_1 = true;
return;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement, element));
});
if (hasError_1) {
return false;

View File

@ -4616,6 +4616,7 @@ var ts;
NodeFlags[NodeFlags["JsonFile"] = 67108864] = "JsonFile";
/* @internal */ NodeFlags[NodeFlags["TypeCached"] = 134217728] = "TypeCached";
/* @internal */ NodeFlags[NodeFlags["Deprecated"] = 268435456] = "Deprecated";
/* @internal */ NodeFlags[NodeFlags["KitImportFlags"] = 536870912] = "KitImportFlags";
NodeFlags[NodeFlags["EtsContext"] = 1073741824] = "EtsContext";
/* @internal */ NodeFlags[NodeFlags["NoOriginalText"] = -2147483648] = "NoOriginalText";
NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
@ -15802,7 +15803,7 @@ var ts;
}
ts.Debug.assert(!ts.isJSDoc(errorNode));
var isMissing = nodeIsMissing(errorNode);
var pos = isMissing || ts.isJsxText(node) || node.virtual
var pos = isMissing || ts.isJsxText(node) || (node.virtual && !(node.flags & 536870912 /* NodeFlags.KitImportFlags */))
? errorNode.pos
: ts.skipTrivia(sourceFile.text, errorNode.pos);
// These asserts should all be satisfied for a properly constructed `errorNode`.
@ -47724,43 +47725,45 @@ var ts;
kitJsonCache === null || kitJsonCache === void 0 ? void 0 : kitJsonCache.clear();
}
ts.cleanKitJsonCache = cleanKitJsonCache;
function setVirtualNode(node, start, end) {
function setVirtualNodeAndKitImportFlags(node, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = 0; }
node.virtual = true;
ts.setTextRangePosEnd(node, start, end);
node.flags |= 536870912 /* NodeFlags.KitImportFlags */;
return node;
}
function setNoOriginalText(node) {
node.flags |= -2147483648 /* NodeFlags.NoOriginalText */;
return node;
}
function createNameImportDeclaration(factory, isType, name, source, oldStatement) {
function createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNode(factory.createImportClause(isType, name, undefined), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, name, undefined), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement) {
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNode(factory.createIdentifier(propname), name.pos, name.end));
var newImportSpecific = setVirtualNode(factory.createImportSpecifier(false, newPropertyName, name), oldImportClause.pos, oldImportClause.end);
var newNamedBindings = setVirtualNode(factory.createNamedImports([newImportSpecific]), oldImportClause.pos, oldImportClause.end);
var newImportClause = setVirtualNode(factory.createImportClause(isType, undefined, newNamedBindings), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createIdentifier(propname), name.pos, name.end));
// The location information of the newImportSpecific is created using the location information of the old importSpecifier.
var newImportSpecific = setVirtualNodeAndKitImportFlags(factory.createImportSpecifier(false, newPropertyName, name), importSpecifier.pos, importSpecifier.end);
// The location information of the newNamedBindings is created using the location information of the old importSpecifier.
var newNamedBindings = setVirtualNodeAndKitImportFlags(factory.createNamedImports([newImportSpecific]), importSpecifier.pos, importSpecifier.end);
// The location information of the newImportClause is created using the location information of the old importSpecifier.
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, undefined, newNamedBindings), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement) {
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement, importSpecifier) {
var source = symbol.source.replace(/\.d.[e]?ts$/, '');
var binding = symbol.bindings;
if (binding === DEFAULT_KEYWORD) {
return createNameImportDeclaration(factory, isType, name, source, oldStatement);
return createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier);
}
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement);
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement, importSpecifier);
}
function markKitImport(statement, markedkitImportRanges) {
markedkitImportRanges.push({ pos: statement.pos, end: statement.end });
@ -47825,7 +47828,7 @@ var ts;
if (!symbol || (!inEtsContext && symbol.source.endsWith(ETS_DECLARATION))) {
return false;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement, importClause.name));
}
if (importClause.namedBindings) {
var hasError_1 = false;
@ -47848,7 +47851,7 @@ var ts;
hasError_1 = true;
return;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement, element));
});
if (hasError_1) {
return false;

View File

@ -4606,6 +4606,7 @@ var ts;
NodeFlags[NodeFlags["JsonFile"] = 67108864] = "JsonFile";
/* @internal */ NodeFlags[NodeFlags["TypeCached"] = 134217728] = "TypeCached";
/* @internal */ NodeFlags[NodeFlags["Deprecated"] = 268435456] = "Deprecated";
/* @internal */ NodeFlags[NodeFlags["KitImportFlags"] = 536870912] = "KitImportFlags";
NodeFlags[NodeFlags["EtsContext"] = 1073741824] = "EtsContext";
/* @internal */ NodeFlags[NodeFlags["NoOriginalText"] = -2147483648] = "NoOriginalText";
NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped";
@ -15792,7 +15793,7 @@ var ts;
}
ts.Debug.assert(!ts.isJSDoc(errorNode));
var isMissing = nodeIsMissing(errorNode);
var pos = isMissing || ts.isJsxText(node) || node.virtual
var pos = isMissing || ts.isJsxText(node) || (node.virtual && !(node.flags & 536870912 /* NodeFlags.KitImportFlags */))
? errorNode.pos
: ts.skipTrivia(sourceFile.text, errorNode.pos);
// These asserts should all be satisfied for a properly constructed `errorNode`.
@ -47714,43 +47715,45 @@ var ts;
kitJsonCache === null || kitJsonCache === void 0 ? void 0 : kitJsonCache.clear();
}
ts.cleanKitJsonCache = cleanKitJsonCache;
function setVirtualNode(node, start, end) {
function setVirtualNodeAndKitImportFlags(node, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = 0; }
node.virtual = true;
ts.setTextRangePosEnd(node, start, end);
node.flags |= 536870912 /* NodeFlags.KitImportFlags */;
return node;
}
function setNoOriginalText(node) {
node.flags |= -2147483648 /* NodeFlags.NoOriginalText */;
return node;
}
function createNameImportDeclaration(factory, isType, name, source, oldStatement) {
function createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNode(factory.createImportClause(isType, name, undefined), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, name, undefined), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement) {
function createBindingImportDeclaration(factory, isType, propname, name, source, oldStatement, importSpecifier) {
var oldModuleSpecifier = oldStatement.moduleSpecifier;
var oldImportClause = oldStatement.importClause; // shouldn't be undefined
var newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNode(factory.createIdentifier(propname), name.pos, name.end));
var newImportSpecific = setVirtualNode(factory.createImportSpecifier(false, newPropertyName, name), oldImportClause.pos, oldImportClause.end);
var newNamedBindings = setVirtualNode(factory.createNamedImports([newImportSpecific]), oldImportClause.pos, oldImportClause.end);
var newImportClause = setVirtualNode(factory.createImportClause(isType, undefined, newNamedBindings), oldImportClause.pos, oldImportClause.end);
var newImportDeclaration = setVirtualNode(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
var newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
var newPropertyName = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createIdentifier(propname), name.pos, name.end));
// The location information of the newImportSpecific is created using the location information of the old importSpecifier.
var newImportSpecific = setVirtualNodeAndKitImportFlags(factory.createImportSpecifier(false, newPropertyName, name), importSpecifier.pos, importSpecifier.end);
// The location information of the newNamedBindings is created using the location information of the old importSpecifier.
var newNamedBindings = setVirtualNodeAndKitImportFlags(factory.createNamedImports([newImportSpecific]), importSpecifier.pos, importSpecifier.end);
// The location information of the newImportClause is created using the location information of the old importSpecifier.
var newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, undefined, newNamedBindings), importSpecifier.pos, importSpecifier.end);
var newImportDeclaration = setVirtualNodeAndKitImportFlags(factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement) {
function createImportDeclarationForKit(factory, isType, name, symbol, oldStatement, importSpecifier) {
var source = symbol.source.replace(/\.d.[e]?ts$/, '');
var binding = symbol.bindings;
if (binding === DEFAULT_KEYWORD) {
return createNameImportDeclaration(factory, isType, name, source, oldStatement);
return createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier);
}
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement);
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement, importSpecifier);
}
function markKitImport(statement, markedkitImportRanges) {
markedkitImportRanges.push({ pos: statement.pos, end: statement.end });
@ -47815,7 +47818,7 @@ var ts;
if (!symbol || (!inEtsContext && symbol.source.endsWith(ETS_DECLARATION))) {
return false;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement, importClause.name));
}
if (importClause.namedBindings) {
var hasError_1 = false;
@ -47838,7 +47841,7 @@ var ts;
hasError_1 = true;
return;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement, element));
});
if (hasError_1) {
return false;

View File

@ -1089,9 +1089,10 @@ namespace ts {
kitJsonCache?.clear();
}
function setVirtualNode<T extends Node>(node: T, start: number = 0, end: number = 0): T {
function setVirtualNodeAndKitImportFlags<T extends Node>(node: T, start: number = 0, end: number = 0): T {
node.virtual = true;
setTextRangePosEnd(node, start, end);
(node as Mutable<T>).flags |= NodeFlags.KitImportFlags;
return node;
}
@ -1101,38 +1102,39 @@ namespace ts {
}
function createNameImportDeclaration(factory: NodeFactory, isType: boolean, name: Identifier, source: string,
oldStatement: ImportDeclaration): ImportDeclaration {
oldStatement: ImportDeclaration, importSpecifier: TextRange): ImportDeclaration {
const oldModuleSpecifier = oldStatement.moduleSpecifier;
const oldImportClause = oldStatement.importClause!; // shouldn't be undefined
const newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
const newImportClause = setVirtualNode(factory.createImportClause(isType, name, undefined), oldImportClause.pos, oldImportClause.end);
const newImportDeclaration = setVirtualNode(
const newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
const newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, name, undefined), importSpecifier.pos, importSpecifier.end);
const newImportDeclaration = setVirtualNodeAndKitImportFlags(
factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createBindingImportDeclaration(factory: NodeFactory, isType: boolean, propname: string, name: Identifier, source: string,
oldStatement: ImportDeclaration): ImportDeclaration {
oldStatement: ImportDeclaration, importSpecifier: TextRange): ImportDeclaration {
const oldModuleSpecifier = oldStatement.moduleSpecifier;
const oldImportClause = oldStatement.importClause!; // shouldn't be undefined
const newModuleSpecifier = setNoOriginalText(setVirtualNode(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
const newPropertyName = setNoOriginalText(setVirtualNode(factory.createIdentifier(propname), name.pos, name.end));
const newImportSpecific = setVirtualNode(factory.createImportSpecifier(false, newPropertyName, name), oldImportClause.pos, oldImportClause.end);
const newNamedBindings = setVirtualNode(factory.createNamedImports([newImportSpecific]), oldImportClause.pos, oldImportClause.end);
const newImportClause = setVirtualNode(factory.createImportClause(isType, undefined, newNamedBindings), oldImportClause.pos, oldImportClause.end);
const newImportDeclaration = setVirtualNode(
const newModuleSpecifier = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createStringLiteral(source), oldModuleSpecifier.pos, oldModuleSpecifier.end));
const newPropertyName = setNoOriginalText(setVirtualNodeAndKitImportFlags(factory.createIdentifier(propname), name.pos, name.end));
// The location information of the newImportSpecific is created using the location information of the old importSpecifier.
const newImportSpecific = setVirtualNodeAndKitImportFlags(factory.createImportSpecifier(false, newPropertyName, name), importSpecifier.pos, importSpecifier.end);
// The location information of the newNamedBindings is created using the location information of the old importSpecifier.
const newNamedBindings = setVirtualNodeAndKitImportFlags(factory.createNamedImports([newImportSpecific]), importSpecifier.pos, importSpecifier.end);
// The location information of the newImportClause is created using the location information of the old importSpecifier.
const newImportClause = setVirtualNodeAndKitImportFlags(factory.createImportClause(isType, undefined, newNamedBindings), importSpecifier.pos, importSpecifier.end);
const newImportDeclaration = setVirtualNodeAndKitImportFlags(
factory.createImportDeclaration(undefined, newImportClause, newModuleSpecifier), oldStatement.pos, oldStatement.end);
return newImportDeclaration;
}
function createImportDeclarationForKit(factory: NodeFactory, isType: boolean, name: Identifier, symbol: KitSymbolInfo,
oldStatement: ImportDeclaration): ImportDeclaration {
oldStatement: ImportDeclaration, importSpecifier: TextRange): ImportDeclaration {
const source = symbol.source.replace(/\.d.[e]?ts$/, '');
const binding = symbol.bindings;
if (binding === DEFAULT_KEYWORD) {
return createNameImportDeclaration(factory, isType, name, source, oldStatement);
return createNameImportDeclaration(factory, isType, name, source, oldStatement, importSpecifier);
}
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement);
return createBindingImportDeclaration(factory, isType, binding, name, source, oldStatement, importSpecifier);
}
function markKitImport(statement : Statement, markedkitImportRanges: Array<TextRange>): void {
@ -1211,7 +1213,7 @@ namespace ts {
if (!symbol || (!inEtsContext && symbol.source.endsWith(ETS_DECLARATION))) {
return false;
}
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement));
newImportStatements.push(createImportDeclarationForKit(factory, isType, importClause.name, symbol, statement, importClause.name));
}
if (importClause.namedBindings) {
@ -1240,7 +1242,7 @@ namespace ts {
}
newImportStatements.push(
createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement));
createImportDeclarationForKit(factory, isType || element.isTypeOnly, aliasName, symbol, statement, element));
}
);
if (hasError) {

View File

@ -802,6 +802,7 @@ namespace ts {
/* @internal */ TypeCached = 1 << 27, // If a type was cached for node at any point
/* @internal */ Deprecated = 1 << 28, // If has '@deprecated' JSDoc tag
/* @internal */ KitImportFlags = 1 << 29, // If node was in a converted kit-import statement
EtsContext = 1 << 30, // If context was parsed as a Struct
/* @internal */ NoOriginalText = 1 << 31, // If don't has original text in source file

View File

@ -1233,7 +1233,7 @@ namespace ts {
Debug.assert(!isJSDoc(errorNode));
const isMissing = nodeIsMissing(errorNode);
const pos = isMissing || isJsxText(node) || node.virtual
const pos = isMissing || isJsxText(node) || (node.virtual && !(node.flags & NodeFlags.KitImportFlags))
? errorNode.pos
: skipTrivia(sourceFile.text, errorNode.pos);