@@ -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 ) ;
0 commit comments