@@ -24,9 +24,9 @@ module ts {
2424 }
2525
2626 /// fullTypeCheck denotes if this instance of the typechecker will be used to get semantic diagnostics.
27- /// If fullTypeCheck === true - then typechecker should do every possible check to produce all errors
28- /// If fullTypeCheck === false - typechecker can shortcut and skip checks that only produce errors.
29- /// NOTE: checks that somehow affects decisions being made during typechecking should be executed in both cases.
27+ /// If fullTypeCheck === true, then the typechecker should do every possible check to produce all errors
28+ /// If fullTypeCheck === false, the typechecker can take shortcuts and skip checks that only produce errors.
29+ /// NOTE: checks that somehow affect decisions being made during typechecking should be executed in both cases.
3030 export function createTypeChecker ( program : Program , fullTypeCheck : boolean ) : TypeChecker {
3131
3232 var Symbol = objectAllocator . getSymbolConstructor ( ) ;
@@ -573,7 +573,7 @@ module ts {
573573 return ( resolveImport ( symbol ) . flags & SymbolFlags . Value ) !== 0 ;
574574 }
575575
576- // If it is an instantiated symbol, then it is a value if hte symbol it is an
576+ // If it is an instantiated symbol, then it is a value if the symbol it is an
577577 // instantiation of is a value.
578578 if ( symbol . flags & SymbolFlags . Instantiated ) {
579579 return ( getSymbolLinks ( symbol ) . target . flags & SymbolFlags . Value ) !== 0 ;
@@ -697,7 +697,7 @@ module ts {
697697 function getAccessibleSymbolChain ( symbol : Symbol , enclosingDeclaration : Node , meaning : SymbolFlags ) : Symbol [ ] {
698698 function getAccessibleSymbolChainFromSymbolTable ( symbols : SymbolTable ) : Symbol [ ] {
699699 function canQualifySymbol ( symbolFromSymbolTable : Symbol , meaning : SymbolFlags ) {
700- // If the symbol is equivalent and doesnt need futher qualification, this symbol is accessible
700+ // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible
701701 if ( ! needsQualification ( symbolFromSymbolTable , enclosingDeclaration , meaning ) ) {
702702 return true ;
703703 }
@@ -793,17 +793,17 @@ module ts {
793793 return { accessibility : SymbolAccessibility . Accessible , aliasesToMakeVisible : hasAccessibleDeclarations . aliasesToMakeVisible } ;
794794 }
795795
796- // If we havent got the accessible symbol doesnt mean the symbol is actually inaccessible.
797- // It could be qualified symbol and hence verify the path
798- // eg :
796+ // If we haven't got the accessible symbol, it doesn't mean the symbol is actually inaccessible.
797+ // It could be a qualified symbol and hence verify the path
798+ // e.g. :
799799 // module m {
800800 // export class c {
801801 // }
802802 // }
803803 // var x: typeof m.c
804804 // In the above example when we start with checking if typeof m.c symbol is accessible,
805805 // we are going to see if c can be accessed in scope directly.
806- // But it cant , hence the accessible is going to be undefined, but that doesnt mean m.c is accessible
806+ // But it can't , hence the accessible is going to be undefined, but that doesn't mean m.c is inaccessible
807807 // It is accessible if the parent m is accessible because then m.c can be accessed through qualification
808808 meaningToLook = getQualifiedLeftMeaning ( meaning ) ;
809809 symbol = getParentOfSymbol ( symbol ) ;
@@ -815,7 +815,7 @@ module ts {
815815 if ( symbolExternalModule ) {
816816 var enclosingExternalModule = getExternalModuleContainer ( enclosingDeclaration ) ;
817817 if ( symbolExternalModule !== enclosingExternalModule ) {
818- // name from different external module that is not visibile
818+ // name from different external module that is not visible
819819 return {
820820 accessibility : SymbolAccessibility . CannotBeNamed ,
821821 errorSymbolName : symbolToString ( initialSymbol , enclosingDeclaration , meaning ) ,
@@ -892,7 +892,7 @@ module ts {
892892 { accessibility : SymbolAccessibility . NotAccessible , errorSymbolName : firstIdentifierName } ;
893893 }
894894
895- // Enclosing declaration is optional when we dont want to get qualified name in the enclosing declaration scope
895+ // Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope
896896 // Meaning needs to be specified if the enclosing declaration is given
897897 function symbolToString ( symbol : Symbol , enclosingDeclaration ?: Node , meaning ?: SymbolFlags ) {
898898 function getSymbolName ( symbol : Symbol ) {
@@ -919,7 +919,7 @@ module ts {
919919 currentSymbolName = ts . map ( accessibleSymbolChain , accessibleSymbol => getSymbolName ( accessibleSymbol ) ) . join ( "." ) ;
920920 }
921921 else {
922- // If we didnt find accessible symbol chain for this symbol, break if this is external module
922+ // If we didn't find accessible symbol chain for this symbol, break if this is external module
923923 if ( ! isFirstName && ts . forEach ( symbol . declarations , declaration => hasExternalModuleSymbol ( declaration ) ) ) {
924924 break ;
925925 }
@@ -991,7 +991,7 @@ module ts {
991991 function writeTypeReference ( type : TypeReference ) {
992992 if ( type . target === globalArrayType && ! ( flags & TypeFormatFlags . WriteArrayAsGenericType ) ) {
993993 // If we are writing array element type the arrow style signatures are not allowed as
994- // we need to surround it by curlies, eg . { (): T; }[]; as () => T[] would mean something different
994+ // we need to surround it by curlies, e.g . { (): T; }[]; as () => T[] would mean something different
995995 writeType ( type . typeArguments [ 0 ] , /*allowFunctionOrConstructorTypeLiteral*/ false ) ;
996996 writer . write ( "[]" ) ;
997997 }
@@ -1244,7 +1244,7 @@ module ts {
12441244 ! ( node . kind !== SyntaxKind . ImportDeclaration && parent . kind !== SyntaxKind . SourceFile && isInAmbientContext ( parent ) ) ) {
12451245 return isGlobalSourceFile ( parent ) || isUsedInExportAssignment ( node ) ;
12461246 }
1247- // Exported members/ambient module elements (exception import declaraiton ) are visible if parent is visible
1247+ // Exported members/ambient module elements (exception import declaration ) are visible if parent is visible
12481248 return isDeclarationVisible ( parent ) ;
12491249
12501250 case SyntaxKind . Property :
@@ -4032,7 +4032,7 @@ module ts {
40324032 }
40334033 else {
40344034 // current declaration belongs to a different symbol
4035- // set cutoffPos so reorderings in the future won't change result set from 0 to cutoffPos
4035+ // set cutoffPos so re-orderings in the future won't change result set from 0 to cutoffPos
40364036 pos = cutoffPos = result . length ;
40374037 lastParent = parent ;
40384038 }
@@ -4782,7 +4782,7 @@ module ts {
47824782 var ok = checkReferenceExpression ( node . left , Diagnostics . Invalid_left_hand_side_of_assignment_expression ) ;
47834783 // Use default messages
47844784 if ( ok ) {
4785- // to avoid cascading errors check assignability only if 'isReference' check succeded and no errors were reported
4785+ // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
47864786 checkTypeAssignableTo ( valueType , leftType , node . left , /*chainedMessage*/ undefined , /*terminalMessage*/ undefined ) ;
47874787 }
47884788 }
@@ -4828,7 +4828,7 @@ module ts {
48284828 // Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
48294829 // contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the
48304830 // expression is being inferentially typed (section 4.12.2 in spec) and provides the type mapper to use in
4831- // conjuction with the generic contextual type. When contextualMapper is equal to the identityMapper function
4831+ // conjunction with the generic contextual type. When contextualMapper is equal to the identityMapper function
48324832 // object, it serves as an indicator that all contained function and arrow expressions should be considered to
48334833 // have the wildcard function type; this form of type check is used during overload resolution to exclude
48344834 // contextually typed function and arrow expressions in the initial phase.
@@ -4933,7 +4933,7 @@ module ts {
49334933 // legal case - parameter initializer references some parameter strictly on left of current parameter declaration
49344934 return ;
49354935 }
4936- // fallthrough to error reporting
4936+ // fall through to error reporting
49374937 }
49384938
49394939 error ( n , Diagnostics . Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it , identifierToString ( parameterDeclaration . name ) , identifierToString ( < Identifier > n ) ) ;
@@ -5325,7 +5325,7 @@ module ts {
53255325 }
53265326
53275327 // when checking exported function declarations across modules check only duplicate implementations
5328- // names and consistensy of modifiers are verified when we check local symbol
5328+ // names and consistency of modifiers are verified when we check local symbol
53295329 var isExportSymbolInsideModule = symbol . parent && symbol . parent . flags & SymbolFlags . Module ;
53305330 for ( var i = 0 ; i < declarations . length ; i ++ ) {
53315331 var node = < FunctionDeclaration > declarations [ i ] ;
@@ -5421,7 +5421,7 @@ module ts {
54215421 var symbol : Symbol ;
54225422
54235423 // Exports should be checked only if enclosing module contains both exported and non exported declarations.
5424- // In case if all declarations are non-exported check is unnecesary .
5424+ // In case if all declarations are non-exported check is unnecessary .
54255425
54265426 // if localSymbol is defined on node then node itself is exported - check is required
54275427 var symbol = node . localSymbol ;
@@ -5866,7 +5866,7 @@ module ts {
58665866 checkTypeAssignableTo ( checkExpression ( node . expression ) , returnType , node . expression , /*chainedMessage*/ undefined , /*terminalMessage*/ undefined ) ;
58675867 }
58685868 else if ( func . kind == SyntaxKind . Constructor ) {
5869- // constructor doesn't have explicit return type annontation and yet its return type is known - declaring type
5869+ // constructor doesn't have explicit return type annotation and yet its return type is known - declaring type
58705870 // handle constructors and issue specialized error message for them.
58715871 if ( ! isTypeAssignableTo ( checkExpression ( node . expression ) , returnType ) ) {
58725872 error ( node . expression , Diagnostics . Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class ) ;
@@ -6113,7 +6113,7 @@ module ts {
61136113 }
61146114
61156115 if ( ( base . flags & derived . flags & SymbolFlags . Method ) || ( ( base . flags & SymbolFlags . PropertyOrAccessor ) && ( derived . flags & SymbolFlags . PropertyOrAccessor ) ) ) {
6116- // method is overridden with method or property\ accessor is overridden with property\ accessor - correct case
6116+ // method is overridden with method or property/ accessor is overridden with property/ accessor - correct case
61176117 continue ;
61186118 }
61196119
@@ -6965,7 +6965,7 @@ module ts {
69656965 return moduleType ? moduleType . symbol : undefined ;
69666966 }
69676967
6968- // Intentinal fallthrough
6968+ // Intentional fall-through
69696969 case SyntaxKind . NumericLiteral :
69706970 // index access
69716971 if ( node . parent . kind == SyntaxKind . IndexedAccess && ( < IndexedAccess > node . parent ) . index === node ) {
@@ -7030,7 +7030,7 @@ module ts {
70307030 var apparentType = getApparentType ( type ) ;
70317031
70327032 if ( apparentType . flags & TypeFlags . ObjectType ) {
7033- // Augment the apprent type with Function and Object memeber as applicaple
7033+ // Augment the apparent type with Function and Object members as applicable
70347034 var propertiesByName : Map < Symbol > = { } ;
70357035 var results : Symbol [ ] = [ ] ;
70367036
@@ -7187,17 +7187,17 @@ module ts {
71877187 var symbol = getSymbolOfNode ( node ) ;
71887188 var signaturesOfSymbol = getSignaturesOfSymbol ( symbol ) ;
71897189 // If this function body corresponds to function with multiple signature, it is implementation of overload
7190- // eg : function foo(a: string): string;
7191- // function foo(a: number): number;
7192- // function foo(a: any) { // This is implementation of the overloads
7193- // return a;
7194- // }
7190+ // e.g. : function foo(a: string): string;
7191+ // function foo(a: number): number;
7192+ // function foo(a: any) { // This is implementation of the overloads
7193+ // return a;
7194+ // }
71957195 return signaturesOfSymbol . length > 1 ||
7196- // If there is single signature for the symbol, it is overload if that signature isnt coming from the node
7197- // eg : function foo(a: string): string;
7198- // function foo(a: any) { // This is implementation of the overloads
7199- // return a;
7200- // }
7196+ // If there is single signature for the symbol, it is overload if that signature isn't coming from the node
7197+ // e.g. : function foo(a: string): string;
7198+ // function foo(a: any) { // This is implementation of the overloads
7199+ // return a;
7200+ // }
72017201 ( signaturesOfSymbol . length === 1 && signaturesOfSymbol [ 0 ] . declaration !== node ) ;
72027202 }
72037203 return false ;
0 commit comments