@@ -125,7 +125,7 @@ var ts;
125
125
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* Error */, key: "Import declarations in an internal module cannot reference an external module." },
126
126
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1 /* Error */, key: "Cannot compile external modules unless the '--module' flag is provided." },
127
127
Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: 1 /* Error */, key: "Filename '{0}' differs from already included filename '{1}' only in casing" },
128
- new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 2068 , category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
128
+ new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150 , category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
129
129
Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." },
130
130
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* Error */, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
131
131
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1 /* Error */, key: "Static members cannot reference class type parameters." },
@@ -402,7 +402,8 @@ var ts;
402
402
Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." },
403
403
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
404
404
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
405
- Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }
405
+ Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
406
+ You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." }
406
407
};
407
408
})(ts || (ts = {}));
408
409
var ts;
@@ -1938,9 +1939,9 @@ var ts;
1938
1939
if (ts.localizedDiagnosticMessages) {
1939
1940
message = ts.localizedDiagnosticMessages[message];
1940
1941
}
1941
- Debug.assert(message, "Diagnostic message does not exist in locale map.");
1942
1942
return message;
1943
1943
}
1944
+ ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
1944
1945
function createFileDiagnostic(file, start, length, message) {
1945
1946
var text = getLocaleSpecificMessage(message.key);
1946
1947
if (arguments.length > 4) {
@@ -2247,7 +2248,7 @@ var ts;
2247
2248
(function (Debug) {
2248
2249
var currentAssertionLevel = 0 /* None */;
2249
2250
function shouldAssert(level) {
2250
- return this. currentAssertionLevel >= level;
2251
+ return currentAssertionLevel >= level;
2251
2252
}
2252
2253
Debug.shouldAssert = shouldAssert;
2253
2254
function assert(expression, message, verboseDebugInfo) {
@@ -2823,7 +2824,6 @@ var ts;
2823
2824
ControlBlockContext[ControlBlockContext["CrossingFunctionBoundary"] = 2] = "CrossingFunctionBoundary";
2824
2825
})(ControlBlockContext || (ControlBlockContext = {}));
2825
2826
function createSourceFile(filename, sourceText, languageVersion, version, isOpen) {
2826
- if (version === void 0) { version = 0; }
2827
2827
if (isOpen === void 0) { isOpen = false; }
2828
2828
var file;
2829
2829
var scanner;
@@ -4331,8 +4331,6 @@ var ts;
4331
4331
function parseBreakOrContinueStatement(kind) {
4332
4332
var node = createNode(kind);
4333
4333
var errorCountBeforeStatement = file.syntacticErrors.length;
4334
- var keywordStart = scanner.getTokenPos();
4335
- var keywordLength = scanner.getTextPos() - keywordStart;
4336
4334
parseExpected(kind === 153 /* BreakStatement */ ? 56 /* BreakKeyword */ : 61 /* ContinueKeyword */);
4337
4335
if (!canParseSemicolon())
4338
4336
node.label = parseIdentifier();
@@ -6056,6 +6054,8 @@ var ts;
6056
6054
} : emitLeadingDeclarationComments;
6057
6055
var emitTrailingComments = compilerOptions.removeComments ? function (node) {
6058
6056
} : emitTrailingDeclarationComments;
6057
+ var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) {
6058
+ } : emitLeadingCommentsOfLocalPosition;
6059
6059
var detachedCommentsInfo;
6060
6060
var emitDetachedComments = compilerOptions.removeComments ? function (node) {
6061
6061
} : emitDetachedCommentsAtPosition;
@@ -6923,12 +6923,14 @@ var ts;
6923
6923
write(";");
6924
6924
emitTrailingComments(node.body);
6925
6925
}
6926
- decreaseIndent();
6927
6926
writeLine();
6928
6927
if (node.body.kind === 168 /* FunctionBlock */) {
6928
+ emitLeadingCommentsOfPosition(node.body.statements.end);
6929
+ decreaseIndent();
6929
6930
emitToken(6 /* CloseBraceToken */, node.body.statements.end);
6930
6931
}
6931
6932
else {
6933
+ decreaseIndent();
6932
6934
emitStart(node.body);
6933
6935
write("}");
6934
6936
emitEnd(node.body);
@@ -7176,8 +7178,11 @@ var ts;
7176
7178
statements = statements.slice(1);
7177
7179
emitLines(statements);
7178
7180
}
7179
- decreaseIndent();
7180
7181
writeLine();
7182
+ if (ctor) {
7183
+ emitLeadingCommentsOfPosition(ctor.body.statements.end);
7184
+ }
7185
+ decreaseIndent();
7181
7186
emitToken(6 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end);
7182
7187
scopeEmitEnd();
7183
7188
emitEnd(ctor || node);
@@ -7438,6 +7443,7 @@ var ts;
7438
7443
}
7439
7444
function emitSourceFile(node) {
7440
7445
currentSourceFile = node;
7446
+ writeLine();
7441
7447
emitDetachedComments(node);
7442
7448
var startIndex = emitDirectivePrologues(node.statements, false);
7443
7449
if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */) {
@@ -7586,20 +7592,27 @@ var ts;
7586
7592
return emitSourceFile(node);
7587
7593
}
7588
7594
}
7595
+ function hasDetachedComments(pos) {
7596
+ return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos;
7597
+ }
7598
+ function getLeadingCommentsWithoutDetachedComments() {
7599
+ var leadingComments = ts.getLeadingComments(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
7600
+ if (detachedCommentsInfo.length - 1) {
7601
+ detachedCommentsInfo.pop();
7602
+ }
7603
+ else {
7604
+ detachedCommentsInfo = undefined;
7605
+ }
7606
+ return leadingComments;
7607
+ }
7589
7608
function emitLeadingDeclarationComments(node) {
7590
7609
if (node.parent.kind === 177 /* SourceFile */ || node.pos !== node.parent.pos) {
7591
7610
var leadingComments;
7592
- if (detachedCommentsInfo === undefined || detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos !== node.pos) {
7593
- leadingComments = ts.getLeadingCommentsOfNode(node, currentSourceFile );
7611
+ if (hasDetachedComments( node.pos) ) {
7612
+ leadingComments = getLeadingCommentsWithoutDetachedComments( );
7594
7613
}
7595
7614
else {
7596
- leadingComments = ts.getLeadingComments(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos);
7597
- if (detachedCommentsInfo.length - 1) {
7598
- detachedCommentsInfo.pop();
7599
- }
7600
- else {
7601
- detachedCommentsInfo = undefined;
7602
- }
7615
+ leadingComments = ts.getLeadingCommentsOfNode(node, currentSourceFile);
7603
7616
}
7604
7617
emitNewLineBeforeLeadingComments(node, leadingComments, writer);
7605
7618
emitComments(leadingComments, true, writer, writeComment);
@@ -7611,6 +7624,17 @@ var ts;
7611
7624
emitComments(trailingComments, false, writer, writeComment);
7612
7625
}
7613
7626
}
7627
+ function emitLeadingCommentsOfLocalPosition(pos) {
7628
+ var leadingComments;
7629
+ if (hasDetachedComments(pos)) {
7630
+ leadingComments = getLeadingCommentsWithoutDetachedComments();
7631
+ }
7632
+ else {
7633
+ leadingComments = ts.getLeadingComments(currentSourceFile.text, pos);
7634
+ }
7635
+ emitNewLineBeforeLeadingComments({ pos: pos, end: pos }, leadingComments, writer);
7636
+ emitComments(leadingComments, true, writer, writeComment);
7637
+ }
7614
7638
function emitDetachedCommentsAtPosition(node) {
7615
7639
var leadingComments = ts.getLeadingComments(currentSourceFile.text, node.pos);
7616
7640
if (leadingComments) {
@@ -9561,7 +9585,7 @@ var ts;
9561
9585
function getTypeOfFuncClassEnumModule(symbol) {
9562
9586
var links = getSymbolLinks(symbol);
9563
9587
if (!links.type) {
9564
- var type = links.type = createObjectType(8192 /* Anonymous */, symbol);
9588
+ links.type = createObjectType(8192 /* Anonymous */, symbol);
9565
9589
}
9566
9590
return links.type;
9567
9591
}
@@ -10233,6 +10257,7 @@ var ts;
10233
10257
return emptyObjectType;
10234
10258
}
10235
10259
var type = getDeclaredTypeOfSymbol(symbol);
10260
+ var name = symbol.name;
10236
10261
if (!(type.flags & ts.TypeFlags.ObjectType)) {
10237
10262
error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, name);
10238
10263
return emptyObjectType;
@@ -14465,13 +14490,14 @@ var ts;
14465
14490
return diagnostic.messageText;
14466
14491
}
14467
14492
function reportDiagnostic(diagnostic) {
14493
+ var output = "";
14468
14494
if (diagnostic.file) {
14469
14495
var loc = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
14470
- sys.write(diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): " + diagnostic.messageText + sys.newLine);
14471
- }
14472
- else {
14473
- sys.write(diagnostic.messageText + sys.newLine);
14496
+ output += diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): ";
14474
14497
}
14498
+ var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
14499
+ output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + sys.newLine;
14500
+ sys.write(output);
14475
14501
}
14476
14502
function reportDiagnostics(diagnostics) {
14477
14503
for (var i = 0; i < diagnostics.length; i++) {
@@ -14512,7 +14538,7 @@ var ts;
14512
14538
}
14513
14539
text = "";
14514
14540
}
14515
- return text !== undefined ? ts.createSourceFile(filename, text, languageVersion) : undefined;
14541
+ return text !== undefined ? ts.createSourceFile(filename, text, languageVersion, "0" ) : undefined;
14516
14542
}
14517
14543
function writeFile(fileName, data, writeByteOrderMark, onError) {
14518
14544
function directoryExists(directoryPath) {
0 commit comments