Dont emit names index mapping into the sourcemap
Since sourcemap spec is not very clear about symbol translation and use of nameIndex of the mapping, dont emit it
This commit is contained in:
parent
bd84b844ff
commit
b73ce26937
1 changed files with 0 additions and 107 deletions
|
@ -548,14 +548,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
* @param emitFn if given will be invoked to emit the text instead of actual token emit */
|
* @param emitFn if given will be invoked to emit the text instead of actual token emit */
|
||||||
let emitToken = emitTokenText;
|
let emitToken = emitTokenText;
|
||||||
|
|
||||||
/** Called to before starting the lexical scopes as in function/class in the emitted code because of node
|
|
||||||
* @param scopeDeclaration node that starts the lexical scope
|
|
||||||
* @param scopeName Optional name of this scope instead of deducing one from the declaration node */
|
|
||||||
let scopeEmitStart = function(scopeDeclaration: Node, scopeName?: string) { };
|
|
||||||
|
|
||||||
/** Called after coming out of the scope */
|
|
||||||
let scopeEmitEnd = function() { };
|
|
||||||
|
|
||||||
/** Sourcemap data that will get encoded */
|
/** Sourcemap data that will get encoded */
|
||||||
let sourceMapData: SourceMapData;
|
let sourceMapData: SourceMapData;
|
||||||
|
|
||||||
|
@ -753,13 +745,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
// Current source map file and its index in the sources list
|
// Current source map file and its index in the sources list
|
||||||
let sourceMapSourceIndex = -1;
|
let sourceMapSourceIndex = -1;
|
||||||
|
|
||||||
// Names and its index map
|
|
||||||
const sourceMapNameIndexMap: Map<number> = {};
|
|
||||||
const sourceMapNameIndices: number[] = [];
|
|
||||||
function getSourceMapNameIndex() {
|
|
||||||
return sourceMapNameIndices.length ? lastOrUndefined(sourceMapNameIndices) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Last recorded and encoded spans
|
// Last recorded and encoded spans
|
||||||
let lastRecordedSourceMapSpan: SourceMapSpan;
|
let lastRecordedSourceMapSpan: SourceMapSpan;
|
||||||
let lastEncodedSourceMapSpan: SourceMapSpan = {
|
let lastEncodedSourceMapSpan: SourceMapSpan = {
|
||||||
|
@ -769,7 +754,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
sourceColumn: 1,
|
sourceColumn: 1,
|
||||||
sourceIndex: 0
|
sourceIndex: 0
|
||||||
};
|
};
|
||||||
let lastEncodedNameIndex = 0;
|
|
||||||
|
|
||||||
// Encoding for sourcemap span
|
// Encoding for sourcemap span
|
||||||
function encodeLastRecordedSourceMapSpan() {
|
function encodeLastRecordedSourceMapSpan() {
|
||||||
|
@ -805,12 +789,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
// 4. Relative sourceColumn 0 based
|
// 4. Relative sourceColumn 0 based
|
||||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn);
|
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn);
|
||||||
|
|
||||||
// 5. Relative namePosition 0 based
|
|
||||||
if (lastRecordedSourceMapSpan.nameIndex >= 0) {
|
|
||||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex);
|
|
||||||
lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastEncodedSourceMapSpan = lastRecordedSourceMapSpan;
|
lastEncodedSourceMapSpan = lastRecordedSourceMapSpan;
|
||||||
sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);
|
sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);
|
||||||
|
|
||||||
|
@ -876,7 +854,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
emittedColumn: emittedColumn,
|
emittedColumn: emittedColumn,
|
||||||
sourceLine: sourceLinePos.line,
|
sourceLine: sourceLinePos.line,
|
||||||
sourceColumn: sourceLinePos.character,
|
sourceColumn: sourceLinePos.character,
|
||||||
nameIndex: getSourceMapNameIndex(),
|
|
||||||
sourceIndex: sourceMapSourceIndex
|
sourceIndex: sourceMapSourceIndex
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -929,69 +906,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function recordScopeNameOfNode(node: Node, scopeName?: string) {
|
|
||||||
function recordScopeNameIndex(scopeNameIndex: number) {
|
|
||||||
sourceMapNameIndices.push(scopeNameIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
function recordScopeNameStart(scopeName: string) {
|
|
||||||
let scopeNameIndex = -1;
|
|
||||||
if (scopeName) {
|
|
||||||
const parentIndex = getSourceMapNameIndex();
|
|
||||||
if (parentIndex !== -1) {
|
|
||||||
// Child scopes are always shown with a dot (even if they have no name),
|
|
||||||
// unless it is a computed property. Then it is shown with brackets,
|
|
||||||
// but the brackets are included in the name.
|
|
||||||
const name = (<Declaration>node).name;
|
|
||||||
if (!name || name.kind !== SyntaxKind.ComputedPropertyName) {
|
|
||||||
scopeName = "." + scopeName;
|
|
||||||
}
|
|
||||||
scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
scopeNameIndex = getProperty(sourceMapNameIndexMap, scopeName);
|
|
||||||
if (scopeNameIndex === undefined) {
|
|
||||||
scopeNameIndex = sourceMapData.sourceMapNames.length;
|
|
||||||
sourceMapData.sourceMapNames.push(scopeName);
|
|
||||||
sourceMapNameIndexMap[scopeName] = scopeNameIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
recordScopeNameIndex(scopeNameIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scopeName) {
|
|
||||||
// The scope was already given a name use it
|
|
||||||
recordScopeNameStart(scopeName);
|
|
||||||
}
|
|
||||||
else if (node.kind === SyntaxKind.FunctionDeclaration ||
|
|
||||||
node.kind === SyntaxKind.FunctionExpression ||
|
|
||||||
node.kind === SyntaxKind.MethodDeclaration ||
|
|
||||||
node.kind === SyntaxKind.MethodSignature ||
|
|
||||||
node.kind === SyntaxKind.GetAccessor ||
|
|
||||||
node.kind === SyntaxKind.SetAccessor ||
|
|
||||||
node.kind === SyntaxKind.ModuleDeclaration ||
|
|
||||||
node.kind === SyntaxKind.ClassDeclaration ||
|
|
||||||
node.kind === SyntaxKind.EnumDeclaration) {
|
|
||||||
// Declaration and has associated name use it
|
|
||||||
if ((<Declaration>node).name) {
|
|
||||||
const name = (<Declaration>node).name;
|
|
||||||
// For computed property names, the text will include the brackets
|
|
||||||
scopeName = name.kind === SyntaxKind.ComputedPropertyName
|
|
||||||
? getTextOfNode(name)
|
|
||||||
: (<Identifier>(<Declaration>node).name).text;
|
|
||||||
}
|
|
||||||
recordScopeNameStart(scopeName);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Block just use the name from upper level scope
|
|
||||||
recordScopeNameIndex(getSourceMapNameIndex());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function recordScopeNameEnd() {
|
|
||||||
sourceMapNameIndices.pop();
|
|
||||||
};
|
|
||||||
|
|
||||||
function writeCommentRangeWithMap(currentText: string, currentLineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) {
|
function writeCommentRangeWithMap(currentText: string, currentLineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) {
|
||||||
recordSourceMapSpan(comment.pos);
|
recordSourceMapSpan(comment.pos);
|
||||||
writeCommentRange(currentText, currentLineMap, writer, comment, newLine);
|
writeCommentRange(currentText, currentLineMap, writer, comment, newLine);
|
||||||
|
@ -1134,8 +1048,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
emitStart = recordEmitNodeStartSpan;
|
emitStart = recordEmitNodeStartSpan;
|
||||||
emitEnd = recordEmitNodeEndSpan;
|
emitEnd = recordEmitNodeEndSpan;
|
||||||
emitToken = writeTextWithSpanRecord;
|
emitToken = writeTextWithSpanRecord;
|
||||||
scopeEmitStart = recordScopeNameOfNode;
|
|
||||||
scopeEmitEnd = recordScopeNameEnd;
|
|
||||||
writeComment = writeCommentRangeWithMap;
|
writeComment = writeCommentRangeWithMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3124,7 +3036,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
|
|
||||||
emitToken(SyntaxKind.OpenBraceToken, node.pos);
|
emitToken(SyntaxKind.OpenBraceToken, node.pos);
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
scopeEmitStart(node.parent);
|
|
||||||
if (node.kind === SyntaxKind.ModuleBlock) {
|
if (node.kind === SyntaxKind.ModuleBlock) {
|
||||||
Debug.assert(node.parent.kind === SyntaxKind.ModuleDeclaration);
|
Debug.assert(node.parent.kind === SyntaxKind.ModuleDeclaration);
|
||||||
emitCaptureThisForNodeIfNecessary(node.parent);
|
emitCaptureThisForNodeIfNecessary(node.parent);
|
||||||
|
@ -3136,7 +3047,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
decreaseIndent();
|
decreaseIndent();
|
||||||
writeLine();
|
writeLine();
|
||||||
emitToken(SyntaxKind.CloseBraceToken, node.statements.end);
|
emitToken(SyntaxKind.CloseBraceToken, node.statements.end);
|
||||||
scopeEmitEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitEmbeddedStatement(node: Node) {
|
function emitEmbeddedStatement(node: Node) {
|
||||||
|
@ -4981,8 +4891,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
|
|
||||||
function emitDownLevelExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) {
|
function emitDownLevelExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) {
|
||||||
write(" {");
|
write(" {");
|
||||||
scopeEmitStart(node);
|
|
||||||
|
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
const outPos = writer.getTextPos();
|
const outPos = writer.getTextPos();
|
||||||
emitDetachedCommentsAndUpdateCommentsInfo(node.body);
|
emitDetachedCommentsAndUpdateCommentsInfo(node.body);
|
||||||
|
@ -5021,14 +4929,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
emitStart(node.body);
|
emitStart(node.body);
|
||||||
write("}");
|
write("}");
|
||||||
emitEnd(node.body);
|
emitEnd(node.body);
|
||||||
|
|
||||||
scopeEmitEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) {
|
function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) {
|
||||||
write(" {");
|
write(" {");
|
||||||
scopeEmitStart(node);
|
|
||||||
|
|
||||||
const initialTextPos = writer.getTextPos();
|
const initialTextPos = writer.getTextPos();
|
||||||
|
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
|
@ -5062,7 +4966,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
}
|
}
|
||||||
|
|
||||||
emitToken(SyntaxKind.CloseBraceToken, body.statements.end);
|
emitToken(SyntaxKind.CloseBraceToken, body.statements.end);
|
||||||
scopeEmitEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement {
|
function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement {
|
||||||
|
@ -5348,7 +5251,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
let startIndex = 0;
|
let startIndex = 0;
|
||||||
|
|
||||||
write(" {");
|
write(" {");
|
||||||
scopeEmitStart(node, "constructor");
|
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
if (ctor) {
|
if (ctor) {
|
||||||
// Emit all the directive prologues (like "use strict"). These have to come before
|
// Emit all the directive prologues (like "use strict"). These have to come before
|
||||||
|
@ -5398,7 +5300,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
}
|
}
|
||||||
decreaseIndent();
|
decreaseIndent();
|
||||||
emitToken(SyntaxKind.CloseBraceToken, ctor ? (<Block>ctor.body).statements.end : node.members.end);
|
emitToken(SyntaxKind.CloseBraceToken, ctor ? (<Block>ctor.body).statements.end : node.members.end);
|
||||||
scopeEmitEnd();
|
|
||||||
emitEnd(<Node>ctor || node);
|
emitEnd(<Node>ctor || node);
|
||||||
if (ctor) {
|
if (ctor) {
|
||||||
emitTrailingComments(ctor);
|
emitTrailingComments(ctor);
|
||||||
|
@ -5535,14 +5436,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
|
|
||||||
write(" {");
|
write(" {");
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
scopeEmitStart(node);
|
|
||||||
writeLine();
|
writeLine();
|
||||||
emitConstructor(node, baseTypeNode);
|
emitConstructor(node, baseTypeNode);
|
||||||
emitMemberFunctionsForES6AndHigher(node);
|
emitMemberFunctionsForES6AndHigher(node);
|
||||||
decreaseIndent();
|
decreaseIndent();
|
||||||
writeLine();
|
writeLine();
|
||||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||||
scopeEmitEnd();
|
|
||||||
|
|
||||||
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
|
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
|
||||||
|
|
||||||
|
@ -5629,7 +5528,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
tempParameters = undefined;
|
tempParameters = undefined;
|
||||||
computedPropertyNamesToGeneratedNames = undefined;
|
computedPropertyNamesToGeneratedNames = undefined;
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
scopeEmitStart(node);
|
|
||||||
if (baseTypeNode) {
|
if (baseTypeNode) {
|
||||||
writeLine();
|
writeLine();
|
||||||
emitStart(baseTypeNode);
|
emitStart(baseTypeNode);
|
||||||
|
@ -5662,7 +5560,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
decreaseIndent();
|
decreaseIndent();
|
||||||
writeLine();
|
writeLine();
|
||||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||||
scopeEmitEnd();
|
|
||||||
emitStart(node);
|
emitStart(node);
|
||||||
write(")(");
|
write(")(");
|
||||||
if (baseTypeNode) {
|
if (baseTypeNode) {
|
||||||
|
@ -6225,12 +6122,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
emitEnd(node.name);
|
emitEnd(node.name);
|
||||||
write(") {");
|
write(") {");
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
scopeEmitStart(node);
|
|
||||||
emitLines(node.members);
|
emitLines(node.members);
|
||||||
decreaseIndent();
|
decreaseIndent();
|
||||||
writeLine();
|
writeLine();
|
||||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||||
scopeEmitEnd();
|
|
||||||
write(")(");
|
write(")(");
|
||||||
emitModuleMemberName(node);
|
emitModuleMemberName(node);
|
||||||
write(" || (");
|
write(" || (");
|
||||||
|
@ -6354,7 +6249,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
else {
|
else {
|
||||||
write("{");
|
write("{");
|
||||||
increaseIndent();
|
increaseIndent();
|
||||||
scopeEmitStart(node);
|
|
||||||
emitCaptureThisForNodeIfNecessary(node);
|
emitCaptureThisForNodeIfNecessary(node);
|
||||||
writeLine();
|
writeLine();
|
||||||
emit(node.body);
|
emit(node.body);
|
||||||
|
@ -6362,7 +6256,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||||
writeLine();
|
writeLine();
|
||||||
const moduleBlock = <ModuleBlock>getInnerMostModuleDeclarationFromDottedModule(node).body;
|
const moduleBlock = <ModuleBlock>getInnerMostModuleDeclarationFromDottedModule(node).body;
|
||||||
emitToken(SyntaxKind.CloseBraceToken, moduleBlock.statements.end);
|
emitToken(SyntaxKind.CloseBraceToken, moduleBlock.statements.end);
|
||||||
scopeEmitEnd();
|
|
||||||
}
|
}
|
||||||
write(")(");
|
write(")(");
|
||||||
// write moduleDecl = containingModule.m only if it is not exported es6 module member
|
// write moduleDecl = containingModule.m only if it is not exported es6 module member
|
||||||
|
|
Loading…
Reference in a new issue