Skip to content

Commit 042b965

Browse files
committed
Merge branch 'master' into fixArrowBindingPattern
2 parents 02d88f2 + ad477c7 commit 042b965

File tree

277 files changed

+5819
-835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+5819
-835
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Your pull request should:
2525
* Tests should include reasonable permutations of the target fix/change
2626
* Include baseline changes with your change
2727
* All changed code must have 100% code coverage
28-
* Follow the code conventions descriped in [Coding guidlines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidlines)
28+
* Follow the code conventions descriped in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines)
2929
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
3030

3131
## Running the Tests

src/compiler/checker.ts

Lines changed: 110 additions & 64 deletions
Large diffs are not rendered by default.

src/compiler/core.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ module ts {
434434
return path.replace(/\\/g, "/");
435435
}
436436

437-
// Returns length of path root (i.e. length of "/", "x:/", "//server/share/")
437+
// Returns length of path root (i.e. length of "/", "x:/", "//server/share/, file:///user/files")
438438
export function getRootLength(path: string): number {
439439
if (path.charCodeAt(0) === CharacterCodes.slash) {
440440
if (path.charCodeAt(1) !== CharacterCodes.slash) return 1;
@@ -448,6 +448,8 @@ module ts {
448448
if (path.charCodeAt(2) === CharacterCodes.slash) return 3;
449449
return 2;
450450
}
451+
let idx = path.indexOf('://');
452+
if (idx !== -1) return idx + 3
451453
return 0;
452454
}
453455

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ module ts {
344344
The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." },
345345
The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." },
346346
Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: DiagnosticCategory.Error, key: "Invalid left-hand side in 'for...of' statement." },
347-
The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: DiagnosticCategory.Error, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." },
348-
The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." },
347+
Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: DiagnosticCategory.Error, key: "Type must have a '[Symbol.iterator]()' method that returns an iterator." },
348+
An_iterator_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "An iterator must have a 'next()' method." },
349349
The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: DiagnosticCategory.Error, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." },
350350
The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." },
351351
Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" },

src/compiler/diagnosticMessages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,11 +1367,11 @@
13671367
"category": "Error",
13681368
"code": 2487
13691369
},
1370-
"The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator.": {
1370+
"Type must have a '[Symbol.iterator]()' method that returns an iterator.": {
13711371
"category": "Error",
13721372
"code": 2488
13731373
},
1374-
"The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method.": {
1374+
"An iterator must have a 'next()' method.": {
13751375
"category": "Error",
13761376
"code": 2489
13771377
},

src/compiler/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5309,7 +5309,7 @@ module ts {
53095309
break;
53105310
}
53115311

5312-
let range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() };
5312+
let range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() };
53135313

53145314
let comment = sourceText.substring(range.pos, range.end);
53155315
let referencePathMatchResult = getFileReferenceFromReferencePath(comment, range);

src/compiler/scanner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ module ts {
523523
let nextChar = text.charCodeAt(pos + 1);
524524
let hasTrailingNewLine = false;
525525
if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) {
526+
let kind = nextChar === CharacterCodes.slash ? SyntaxKind.SingleLineCommentTrivia : SyntaxKind.MultiLineCommentTrivia;
526527
let startPos = pos;
527528
pos += 2;
528529
if (nextChar === CharacterCodes.slash) {
@@ -548,7 +549,7 @@ module ts {
548549
result = [];
549550
}
550551

551-
result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine });
552+
result.push({ pos: startPos, end: pos, hasTrailingNewLine, kind });
552553
}
553554
continue;
554555
}

src/compiler/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ module ts {
985985

986986
export interface CommentRange extends TextRange {
987987
hasTrailingNewLine?: boolean;
988+
kind: SyntaxKind;
988989
}
989990

990991
// Source files are declarations when they are external modules.

src/compiler/utilities.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ module ts {
160160
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
161161
}
162162

163+
export function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number {
164+
if (nodeIsMissing(node) || !node.decorators) {
165+
return getTokenPosOfNode(node, sourceFile);
166+
}
167+
168+
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);
169+
}
170+
163171
export function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string {
164172
if (nodeIsMissing(node)) {
165173
return "";
@@ -780,6 +788,8 @@ module ts {
780788
return node === (<TemplateSpan>parent).expression;
781789
case SyntaxKind.ComputedPropertyName:
782790
return node === (<ComputedPropertyName>parent).expression;
791+
case SyntaxKind.Decorator:
792+
return true;
783793
default:
784794
if (isExpression(parent)) {
785795
return true;

src/harness/harnessLanguageService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ module Harness.LanguageService {
336336
getOccurrencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
337337
return unwrapJSONCallResult(this.shim.getOccurrencesAtPosition(fileName, position));
338338
}
339+
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): ts.DocumentHighlights[] {
340+
return unwrapJSONCallResult(this.shim.getDocumentHighlights(fileName, position, JSON.stringify(filesToSearch)));
341+
}
339342
getNavigateToItems(searchValue: string): ts.NavigateToItem[] {
340343
return unwrapJSONCallResult(this.shim.getNavigateToItems(searchValue));
341344
}

0 commit comments

Comments
 (0)