@@ -125,7 +125,7 @@ var ts;
125125 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." },
126126 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." },
127127 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." },
129129 Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." },
130130 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." },
131131 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;
402402 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." },
403403 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." },
404404 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." }
406407 };
407408})(ts || (ts = {}));
408409var ts;
@@ -1938,9 +1939,9 @@ var ts;
19381939 if (ts.localizedDiagnosticMessages) {
19391940 message = ts.localizedDiagnosticMessages[message];
19401941 }
1941- Debug.assert(message, "Diagnostic message does not exist in locale map.");
19421942 return message;
19431943 }
1944+ ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
19441945 function createFileDiagnostic(file, start, length, message) {
19451946 var text = getLocaleSpecificMessage(message.key);
19461947 if (arguments.length > 4) {
@@ -2247,7 +2248,7 @@ var ts;
22472248 (function (Debug) {
22482249 var currentAssertionLevel = 0 /* None */;
22492250 function shouldAssert(level) {
2250- return this. currentAssertionLevel >= level;
2251+ return currentAssertionLevel >= level;
22512252 }
22522253 Debug.shouldAssert = shouldAssert;
22532254 function assert(expression, message, verboseDebugInfo) {
@@ -2823,7 +2824,6 @@ var ts;
28232824 ControlBlockContext[ControlBlockContext["CrossingFunctionBoundary"] = 2] = "CrossingFunctionBoundary";
28242825 })(ControlBlockContext || (ControlBlockContext = {}));
28252826 function createSourceFile(filename, sourceText, languageVersion, version, isOpen) {
2826- if (version === void 0) { version = 0; }
28272827 if (isOpen === void 0) { isOpen = false; }
28282828 var file;
28292829 var scanner;
@@ -4331,8 +4331,6 @@ var ts;
43314331 function parseBreakOrContinueStatement(kind) {
43324332 var node = createNode(kind);
43334333 var errorCountBeforeStatement = file.syntacticErrors.length;
4334- var keywordStart = scanner.getTokenPos();
4335- var keywordLength = scanner.getTextPos() - keywordStart;
43364334 parseExpected(kind === 153 /* BreakStatement */ ? 56 /* BreakKeyword */ : 61 /* ContinueKeyword */);
43374335 if (!canParseSemicolon())
43384336 node.label = parseIdentifier();
@@ -6056,6 +6054,8 @@ var ts;
60566054 } : emitLeadingDeclarationComments;
60576055 var emitTrailingComments = compilerOptions.removeComments ? function (node) {
60586056 } : emitTrailingDeclarationComments;
6057+ var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) {
6058+ } : emitLeadingCommentsOfLocalPosition;
60596059 var detachedCommentsInfo;
60606060 var emitDetachedComments = compilerOptions.removeComments ? function (node) {
60616061 } : emitDetachedCommentsAtPosition;
@@ -6923,12 +6923,14 @@ var ts;
69236923 write(";");
69246924 emitTrailingComments(node.body);
69256925 }
6926- decreaseIndent();
69276926 writeLine();
69286927 if (node.body.kind === 168 /* FunctionBlock */) {
6928+ emitLeadingCommentsOfPosition(node.body.statements.end);
6929+ decreaseIndent();
69296930 emitToken(6 /* CloseBraceToken */, node.body.statements.end);
69306931 }
69316932 else {
6933+ decreaseIndent();
69326934 emitStart(node.body);
69336935 write("}");
69346936 emitEnd(node.body);
@@ -7176,8 +7178,11 @@ var ts;
71767178 statements = statements.slice(1);
71777179 emitLines(statements);
71787180 }
7179- decreaseIndent();
71807181 writeLine();
7182+ if (ctor) {
7183+ emitLeadingCommentsOfPosition(ctor.body.statements.end);
7184+ }
7185+ decreaseIndent();
71817186 emitToken(6 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end);
71827187 scopeEmitEnd();
71837188 emitEnd(ctor || node);
@@ -7438,6 +7443,7 @@ var ts;
74387443 }
74397444 function emitSourceFile(node) {
74407445 currentSourceFile = node;
7446+ writeLine();
74417447 emitDetachedComments(node);
74427448 var startIndex = emitDirectivePrologues(node.statements, false);
74437449 if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */) {
@@ -7586,20 +7592,27 @@ var ts;
75867592 return emitSourceFile(node);
75877593 }
75887594 }
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+ }
75897608 function emitLeadingDeclarationComments(node) {
75907609 if (node.parent.kind === 177 /* SourceFile */ || node.pos !== node.parent.pos) {
75917610 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( );
75947613 }
75957614 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);
76037616 }
76047617 emitNewLineBeforeLeadingComments(node, leadingComments, writer);
76057618 emitComments(leadingComments, true, writer, writeComment);
@@ -7611,6 +7624,17 @@ var ts;
76117624 emitComments(trailingComments, false, writer, writeComment);
76127625 }
76137626 }
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+ }
76147638 function emitDetachedCommentsAtPosition(node) {
76157639 var leadingComments = ts.getLeadingComments(currentSourceFile.text, node.pos);
76167640 if (leadingComments) {
@@ -9561,7 +9585,7 @@ var ts;
95619585 function getTypeOfFuncClassEnumModule(symbol) {
95629586 var links = getSymbolLinks(symbol);
95639587 if (!links.type) {
9564- var type = links.type = createObjectType(8192 /* Anonymous */, symbol);
9588+ links.type = createObjectType(8192 /* Anonymous */, symbol);
95659589 }
95669590 return links.type;
95679591 }
@@ -10233,6 +10257,7 @@ var ts;
1023310257 return emptyObjectType;
1023410258 }
1023510259 var type = getDeclaredTypeOfSymbol(symbol);
10260+ var name = symbol.name;
1023610261 if (!(type.flags & ts.TypeFlags.ObjectType)) {
1023710262 error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, name);
1023810263 return emptyObjectType;
@@ -14465,13 +14490,14 @@ var ts;
1446514490 return diagnostic.messageText;
1446614491 }
1446714492 function reportDiagnostic(diagnostic) {
14493+ var output = "";
1446814494 if (diagnostic.file) {
1446914495 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 + "): ";
1447414497 }
14498+ var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
14499+ output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + sys.newLine;
14500+ sys.write(output);
1447514501 }
1447614502 function reportDiagnostics(diagnostics) {
1447714503 for (var i = 0; i < diagnostics.length; i++) {
@@ -14512,7 +14538,7 @@ var ts;
1451214538 }
1451314539 text = "";
1451414540 }
14515- return text !== undefined ? ts.createSourceFile(filename, text, languageVersion) : undefined;
14541+ return text !== undefined ? ts.createSourceFile(filename, text, languageVersion, "0" ) : undefined;
1451614542 }
1451714543 function writeFile(fileName, data, writeByteOrderMark, onError) {
1451814544 function directoryExists(directoryPath) {
0 commit comments