Skip to content

Commit 5d299d4

Browse files
committed
Merge branch 'master' into specConformanceTests
2 parents 6fb3c34 + 18c1789 commit 5d299d4

File tree

213 files changed

+3704
-3704
lines changed

Some content is hidden

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

213 files changed

+3704
-3704
lines changed
Binary file not shown.
Binary file not shown.
-1.04 KB
Binary file not shown.
-4.66 KB
Binary file not shown.

src/compiler/checker.ts

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

src/compiler/emitter.ts

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ module ts {
266266
}
267267
}
268268
else {
269-
// Single line comment of styly //....
269+
// Single line comment of style //....
270270
writer.write(currentSourceFile.text.substring(comment.pos, comment.end));
271271
}
272272

@@ -393,15 +393,15 @@ module ts {
393393
}
394394

395395
var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;
396-
// Line/Comma deliminators
396+
// Line/Comma delimiters
397397
if (lastEncodedSourceMapSpan.emittedLine == lastRecordedSourceMapSpan.emittedLine) {
398398
// Emit comma to separate the entry
399399
if (sourceMapData.sourceMapMappings) {
400400
sourceMapData.sourceMapMappings += ",";
401401
}
402402
}
403403
else {
404-
// Emit line deliminators
404+
// Emit line delimiters
405405
for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {
406406
sourceMapData.sourceMapMappings += ";";
407407
}
@@ -470,7 +470,7 @@ module ts {
470470
var emittedLine = writer.getLine();
471471
var emittedColumn = writer.getColumn();
472472

473-
// If this location wasnt recorded or the location in source is going backwards, record the span
473+
// If this location wasn't recorded or the location in source is going backwards, record the span
474474
if (!lastRecordedSourceMapSpan ||
475475
lastRecordedSourceMapSpan.emittedLine != emittedLine ||
476476
lastRecordedSourceMapSpan.emittedColumn != emittedColumn ||
@@ -516,7 +516,7 @@ module ts {
516516
}
517517

518518
function recordNewSourceFileStart(node: SourceFile) {
519-
// Add the the file to tsFilePaths
519+
// Add the file to tsFilePaths
520520
// If sourceroot option: Use the relative path corresponding to the common directory path
521521
// otherwise source locations relative to map file location
522522
var sourcesDirectoryPath = compilerOptions.sourceRoot ? program.getCommonSourceDirectory() : sourceMapDir;
@@ -953,7 +953,7 @@ module ts {
953953
write(tokenToString(node.operator));
954954
}
955955
// In some cases, we need to emit a space between the operator and the operand. One obvious case
956-
// is when the operator is an identifer, like delete or typeof. We also need to do this for plus
956+
// is when the operator is an identifier, like delete or typeof. We also need to do this for plus
957957
// and minus expressions in certain cases. Specifically, consider the following two cases (parens
958958
// are just for clarity of exposition, and not part of the source code):
959959
//
@@ -1755,16 +1755,13 @@ module ts {
17551755
if (!isInstantiated(node)) {
17561756
return emitPinnedOrTripleSlashComments(node);
17571757
}
1758-
17591758
emitLeadingComments(node);
1760-
if (!(node.flags & NodeFlags.Export)) {
1761-
emitStart(node);
1762-
write("var ");
1763-
emit(node.name);
1764-
write(";");
1765-
emitEnd(node);
1766-
writeLine();
1767-
}
1759+
emitStart(node);
1760+
write("var ");
1761+
emit(node.name);
1762+
write(";");
1763+
emitEnd(node);
1764+
writeLine();
17681765
emitStart(node);
17691766
write("(function (");
17701767
emitStart(node.name);
@@ -1788,21 +1785,15 @@ module ts {
17881785
scopeEmitEnd();
17891786
}
17901787
write(")(");
1788+
if (node.flags & NodeFlags.Export) {
1789+
emit(node.name);
1790+
write(" = ");
1791+
}
17911792
emitModuleMemberName(node);
17921793
write(" || (");
17931794
emitModuleMemberName(node);
17941795
write(" = {}));");
17951796
emitEnd(node);
1796-
if (node.flags & NodeFlags.Export) {
1797-
writeLine();
1798-
emitStart(node);
1799-
write("var ");
1800-
emit(node.name);
1801-
write(" = ");
1802-
emitModuleMemberName(node);
1803-
emitEnd(node);
1804-
write(";");
1805-
}
18061797
emitTrailingComments(node);
18071798
}
18081799

@@ -2125,7 +2116,7 @@ module ts {
21252116
}
21262117

21272118
function getLeadingCommentsToEmit(node: Node) {
2128-
// Emit the leading comments only if the parent's pos doesnt match because parent should take care of emitting these comments
2119+
// Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments
21292120
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
21302121
var leadingComments: Comment[];
21312122
if (hasDetachedComments(node.pos)) {
@@ -2148,7 +2139,7 @@ module ts {
21482139
}
21492140

21502141
function emitTrailingDeclarationComments(node: Node) {
2151-
// Emit the trailing comments only if the parent's end doesnt match
2142+
// Emit the trailing comments only if the parent's end doesn't match
21522143
if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) {
21532144
var trailingComments = getTrailingComments(currentSourceFile.text, node.end);
21542145
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
@@ -2224,7 +2215,7 @@ module ts {
22242215
return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation;
22252216
}
22262217
// Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text
2227-
// so that we dont end up computing comment string and doing match for all // comments
2218+
// so that we don't end up computing comment string and doing match for all // comments
22282219
else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash &&
22292220
comment.pos + 2 < comment.end &&
22302221
currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.slash &&
@@ -2700,7 +2691,7 @@ module ts {
27002691
}
27012692

27022693
function emitVariableDeclaration(node: VariableDeclaration) {
2703-
// If we are emitting property it isnt moduleElement and hence we already know it needs to be emitted
2694+
// If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted
27042695
// so there is no check needed to see if declaration is visible
27052696
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
27062697
emitSourceTextOfNode(node.name);
@@ -2724,7 +2715,7 @@ module ts {
27242715
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
27252716
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
27262717
}
2727-
// This check is to ensure we dont report error on constructor parameter property as that error would be reported during parameter emit
2718+
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
27282719
else if (node.kind === SyntaxKind.Property) {
27292720
if (node.flags & NodeFlags.Static) {
27302721
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
@@ -2829,7 +2820,7 @@ module ts {
28292820
}
28302821

28312822
function emitFunctionDeclaration(node: FunctionDeclaration) {
2832-
// If we are emitting Method/Constructor it isnt moduleElement and hence already determined to be emitting
2823+
// If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting
28332824
// so no need to verify if the declaration is visible
28342825
if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) &&
28352826
!resolver.isImplementationOfOverload(node)) {
@@ -3105,7 +3096,7 @@ module ts {
31053096
}
31063097

31073098
if (root) {
3108-
// Emiting single file so emit references in this file only
3099+
// Emitting just a single file, so emit references in this file only
31093100
if (!compilerOptions.noResolve) {
31103101
var addedGlobalFileReference = false;
31113102
forEach(root.referencedFiles, fileReference => {
@@ -3136,9 +3127,9 @@ module ts {
31363127
forEach(sourceFile.referencedFiles, fileReference => {
31373128
var referencedFile = resolveScriptReference(sourceFile, fileReference);
31383129

3139-
// If the reference file is declaration file or external module emit that reference
3130+
// If the reference file is a declaration file or an external module, emit that reference
31403131
if (isExternalModuleOrDeclarationFile(referencedFile) &&
3141-
!contains(emittedReferencedFiles, referencedFile)) { // If the file refernece was not already emitted
3132+
!contains(emittedReferencedFiles, referencedFile)) { // If the file reference was not already emitted
31423133

31433134
writeReferencePath(referencedFile);
31443135
emittedReferencedFiles.push(referencedFile);

src/compiler/parser.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ module ts {
141141
export function getLeadingCommentsOfNode(node: Node, sourceFileOfNode: SourceFile) {
142142
// If parameter/type parameter, the prev token trailing comments are part of this node too
143143
if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) {
144-
// eg (/** blah */ a, /** blah */ b);
144+
// e.g. (/** blah */ a, /** blah */ b);
145145
return concatenate(getTrailingComments(sourceFileOfNode.text, node.pos),
146-
// eg: (
147-
// /** blah */ a,
148-
// /** blah */ b);
146+
// e.g.: (
147+
// /** blah */ a,
148+
// /** blah */ b);
149149
getLeadingComments(sourceFileOfNode.text, node.pos));
150150
}
151151
else {
@@ -157,7 +157,7 @@ module ts {
157157
return filter(getLeadingCommentsOfNode(node, sourceFileOfNode), comment => isJsDocComment(comment));
158158

159159
function isJsDocComment(comment: Comment) {
160-
// js doc is if comment is starting with /** but not if it is /**/
160+
// True if the comment starts with '/**' but not if it is '/**/'
161161
return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk &&
162162
sourceFileOfNode.text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk &&
163163
sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash;
@@ -661,7 +661,7 @@ module ts {
661661
}
662662

663663
function reportInvalidUseInStrictMode(node: Identifier): void {
664-
// identifierToString cannot be used here since it uses backreference to 'parent' that is not yet set
664+
// identifierToString cannot be used here since it uses a backreference to 'parent' that is not yet set
665665
var name = sourceText.substring(skipTrivia(sourceText, node.pos), node.end);
666666
grammarErrorOnNode(node, Diagnostics.Invalid_use_of_0_in_strict_mode, name);
667667
}
@@ -732,7 +732,7 @@ module ts {
732732
lookAheadMode = LookAheadMode.NoErrorYet;
733733
var result = callback();
734734

735-
// If we switched from 1 to to -1 then a parse error occurred during the callback.
735+
// If we switched from 1 to -1 then a parse error occurred during the callback.
736736
// If that's the case, then we want to act as if we never got any result at all.
737737
Debug.assert(lookAheadMode === LookAheadMode.Error || lookAheadMode === LookAheadMode.NoErrorYet);
738738
if (lookAheadMode === LookAheadMode.Error) {
@@ -1634,7 +1634,7 @@ module ts {
16341634
// (i.e. they're both BinaryExpressions with an assignment operator in it).
16351635

16361636
// First, check if we have an arrow function (production '4') that starts with a parenthesized
1637-
// parameter list. If we do, we must *not* recurse for productsion 1, 2 or 3. An ArrowFunction is
1637+
// parameter list. If we do, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
16381638
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
16391639
// with AssignmentExpression if we see one.
16401640
var arrowExpression = tryParseParenthesizedArrowFunctionExpression();
@@ -1822,7 +1822,7 @@ module ts {
18221822
if (token === SyntaxKind.EqualsGreaterThanToken) {
18231823
// ERROR RECOVERY TWEAK:
18241824
// If we see a standalone => try to parse it as an arrow function expression as that's
1825-
// likely whatthe user intended to write.
1825+
// likely what the user intended to write.
18261826
return Tristate.True;
18271827
}
18281828
// Definitely not a parenthesized arrow function.
@@ -2725,8 +2725,8 @@ module ts {
27252725
switch (token) {
27262726
case SyntaxKind.SemicolonToken:
27272727
// If we're in error recovery, then we don't want to treat ';' as an empty statement.
2728-
// The problem is that ';' can show up in far too many contexts, and if we see one
2729-
// and assume it's a statement, then we may bail out innapropriately from whatever
2728+
// The problem is that ';' can show up in far too many contexts, and if we see one
2729+
// and assume it's a statement, then we may bail out inappropriately from whatever
27302730
// we're parsing. For example, if we have a semicolon in the middle of a class, then
27312731
// we really don't want to assume the class is over and we're on a statement in the
27322732
// outer module. We just want to consume and move on.
@@ -3286,7 +3286,7 @@ module ts {
32863286
function isIntegerLiteral(expression: Expression): boolean {
32873287
function isInteger(literalExpression: LiteralExpression): boolean {
32883288
// Allows for scientific notation since literalExpression.text was formed by
3289-
// coercing a number to a string. Sometimes this coersion can yield a string
3289+
// coercing a number to a string. Sometimes this coercion can yield a string
32903290
// in scientific notation.
32913291
// We also don't need special logic for hex because a hex integer is converted
32923292
// to decimal when it is coerced.
@@ -3308,7 +3308,7 @@ module ts {
33083308

33093309
var inConstantEnumMemberSection = true;
33103310
// In an ambient declaration, the grammar only allows integer literals as initializers.
3311-
// In a nonambient declaration, the grammar allows uninitialized members only in a
3311+
// In a non-ambient declaration, the grammar allows uninitialized members only in a
33123312
// ConstantEnumMemberSection, which starts at the beginning of an enum declaration
33133313
// or any time an integer literal initializer is encountered.
33143314
function parseAndCheckEnumMember(): EnumMember {
@@ -3848,7 +3848,7 @@ module ts {
38483848
commonSourceDirectory = getNormalizedPathFromPathCompoments(commonPathComponents);
38493849
if (commonSourceDirectory) {
38503850
// Make sure directory path ends with directory separator so this string can directly
3851-
// used to replace with "" to get the relative path of the source file and the relative path doesnt
3851+
// used to replace with "" to get the relative path of the source file and the relative path doesn't
38523852
// start with / making it rooted path
38533853
commonSourceDirectory += directorySeparator;
38543854
}

src/compiler/scanner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ module ts {
192192
return false;
193193
}
194194

195-
// Perform binary search in one of the unicode range maps
195+
// Perform binary search in one of the Unicode range maps
196196
var lo: number = 0;
197197
var hi: number = map.length;
198198
var mid: number;
@@ -281,8 +281,8 @@ module ts {
281281
if (lineNumber < 0) {
282282
// If the actual position was not found,
283283
// the binary search returns the negative value of the next line start
284-
// eg. if line starts at [5, 10, 23, 80] and position requested was 20
285-
// the search will return -2
284+
// e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20
285+
// then the search will return -2
286286
lineNumber = (~lineNumber) - 1;
287287
}
288288
return {
@@ -369,7 +369,7 @@ module ts {
369369
// Extract comments from the given source text starting at the given position. If trailing is false, whitespace is skipped until
370370
// the first line break and comments between that location and the next token are returned. If trailing is true, comments occurring
371371
// between the given position and the next line break are returned. The return value is an array containing a TextRange for each
372-
// comment. Single-line comment ranges include the the beginning '//' characters but not the ending line break. Multi-line comment
372+
// comment. Single-line comment ranges include the beginning '//' characters but not the ending line break. Multi-line comment
373373
// ranges include the beginning '/* and ending '*/' characters. The return value is undefined if no comments were found.
374374
function getCommentRanges(text: string, pos: number, trailing: boolean): Comment[] {
375375
var result: Comment[];

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ module ts {
648648
export interface SymbolAccessiblityResult {
649649
accessibility: SymbolAccessibility;
650650
errorSymbolName?: string // Optional symbol name that results in error
651-
errorModuleName?: string // If the symbol is not visibile from module, module's name
651+
errorModuleName?: string // If the symbol is not visible from module, module's name
652652
aliasesToMakeVisible?: ImportDeclaration[]; // aliases that need to have this symbol visible
653653
}
654654

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ var A;
5353
return Point;
5454
})();
5555
A.Point = Point;
56+
var Point;
5657
(function (Point) {
5758
function Origin() {
5859
return "";
5960
}
6061
Point.Origin = Origin; //expected duplicate identifier error
61-
})(A.Point || (A.Point = {}));
62-
var Point = A.Point;
62+
})(Point = A.Point || (A.Point = {}));
6363
})(A || (A = {}));

0 commit comments

Comments
 (0)