@@ -24,9 +24,9 @@ module ts {
24
24
}
25
25
26
26
/// 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.
30
30
export function createTypeChecker ( program : Program , fullTypeCheck : boolean ) : TypeChecker {
31
31
32
32
var Symbol = objectAllocator . getSymbolConstructor ( ) ;
@@ -573,7 +573,7 @@ module ts {
573
573
return ( resolveImport ( symbol ) . flags & SymbolFlags . Value ) !== 0 ;
574
574
}
575
575
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
577
577
// instantiation of is a value.
578
578
if ( symbol . flags & SymbolFlags . Instantiated ) {
579
579
return ( getSymbolLinks ( symbol ) . target . flags & SymbolFlags . Value ) !== 0 ;
@@ -697,7 +697,7 @@ module ts {
697
697
function getAccessibleSymbolChain ( symbol : Symbol , enclosingDeclaration : Node , meaning : SymbolFlags ) : Symbol [ ] {
698
698
function getAccessibleSymbolChainFromSymbolTable ( symbols : SymbolTable ) : Symbol [ ] {
699
699
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
701
701
if ( ! needsQualification ( symbolFromSymbolTable , enclosingDeclaration , meaning ) ) {
702
702
return true ;
703
703
}
@@ -793,17 +793,17 @@ module ts {
793
793
return { accessibility : SymbolAccessibility . Accessible , aliasesToMakeVisible : hasAccessibleDeclarations . aliasesToMakeVisible } ;
794
794
}
795
795
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. :
799
799
// module m {
800
800
// export class c {
801
801
// }
802
802
// }
803
803
// var x: typeof m.c
804
804
// In the above example when we start with checking if typeof m.c symbol is accessible,
805
805
// 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
807
807
// It is accessible if the parent m is accessible because then m.c can be accessed through qualification
808
808
meaningToLook = getQualifiedLeftMeaning ( meaning ) ;
809
809
symbol = getParentOfSymbol ( symbol ) ;
@@ -815,7 +815,7 @@ module ts {
815
815
if ( symbolExternalModule ) {
816
816
var enclosingExternalModule = getExternalModuleContainer ( enclosingDeclaration ) ;
817
817
if ( symbolExternalModule !== enclosingExternalModule ) {
818
- // name from different external module that is not visibile
818
+ // name from different external module that is not visible
819
819
return {
820
820
accessibility : SymbolAccessibility . CannotBeNamed ,
821
821
errorSymbolName : symbolToString ( initialSymbol , enclosingDeclaration , meaning ) ,
@@ -892,7 +892,7 @@ module ts {
892
892
{ accessibility : SymbolAccessibility . NotAccessible , errorSymbolName : firstIdentifierName } ;
893
893
}
894
894
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
896
896
// Meaning needs to be specified if the enclosing declaration is given
897
897
function symbolToString ( symbol : Symbol , enclosingDeclaration ?: Node , meaning ?: SymbolFlags ) {
898
898
function getSymbolName ( symbol : Symbol ) {
@@ -919,7 +919,7 @@ module ts {
919
919
currentSymbolName = ts . map ( accessibleSymbolChain , accessibleSymbol => getSymbolName ( accessibleSymbol ) ) . join ( "." ) ;
920
920
}
921
921
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
923
923
if ( ! isFirstName && ts . forEach ( symbol . declarations , declaration => hasExternalModuleSymbol ( declaration ) ) ) {
924
924
break ;
925
925
}
@@ -991,7 +991,7 @@ module ts {
991
991
function writeTypeReference ( type : TypeReference ) {
992
992
if ( type . target === globalArrayType && ! ( flags & TypeFormatFlags . WriteArrayAsGenericType ) ) {
993
993
// 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
995
995
writeType ( type . typeArguments [ 0 ] , /*allowFunctionOrConstructorTypeLiteral*/ false ) ;
996
996
writer . write ( "[]" ) ;
997
997
}
@@ -1244,7 +1244,7 @@ module ts {
1244
1244
! ( node . kind !== SyntaxKind . ImportDeclaration && parent . kind !== SyntaxKind . SourceFile && isInAmbientContext ( parent ) ) ) {
1245
1245
return isGlobalSourceFile ( parent ) || isUsedInExportAssignment ( node ) ;
1246
1246
}
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
1248
1248
return isDeclarationVisible ( parent ) ;
1249
1249
1250
1250
case SyntaxKind . Property :
@@ -4032,7 +4032,7 @@ module ts {
4032
4032
}
4033
4033
else {
4034
4034
// 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
4036
4036
pos = cutoffPos = result . length ;
4037
4037
lastParent = parent ;
4038
4038
}
@@ -4782,7 +4782,7 @@ module ts {
4782
4782
var ok = checkReferenceExpression ( node . left , Diagnostics . Invalid_left_hand_side_of_assignment_expression ) ;
4783
4783
// Use default messages
4784
4784
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
4786
4786
checkTypeAssignableTo ( valueType , leftType , node . left , /*chainedMessage*/ undefined , /*terminalMessage*/ undefined ) ;
4787
4787
}
4788
4788
}
@@ -4828,7 +4828,7 @@ module ts {
4828
4828
// Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
4829
4829
// contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the
4830
4830
// 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
4832
4832
// object, it serves as an indicator that all contained function and arrow expressions should be considered to
4833
4833
// have the wildcard function type; this form of type check is used during overload resolution to exclude
4834
4834
// contextually typed function and arrow expressions in the initial phase.
@@ -4933,7 +4933,7 @@ module ts {
4933
4933
// legal case - parameter initializer references some parameter strictly on left of current parameter declaration
4934
4934
return ;
4935
4935
}
4936
- // fallthrough to error reporting
4936
+ // fall through to error reporting
4937
4937
}
4938
4938
4939
4939
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 {
5325
5325
}
5326
5326
5327
5327
// 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
5329
5329
var isExportSymbolInsideModule = symbol . parent && symbol . parent . flags & SymbolFlags . Module ;
5330
5330
for ( var i = 0 ; i < declarations . length ; i ++ ) {
5331
5331
var node = < FunctionDeclaration > declarations [ i ] ;
@@ -5421,7 +5421,7 @@ module ts {
5421
5421
var symbol : Symbol ;
5422
5422
5423
5423
// 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 .
5425
5425
5426
5426
// if localSymbol is defined on node then node itself is exported - check is required
5427
5427
var symbol = node . localSymbol ;
@@ -5866,7 +5866,7 @@ module ts {
5866
5866
checkTypeAssignableTo ( checkExpression ( node . expression ) , returnType , node . expression , /*chainedMessage*/ undefined , /*terminalMessage*/ undefined ) ;
5867
5867
}
5868
5868
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
5870
5870
// handle constructors and issue specialized error message for them.
5871
5871
if ( ! isTypeAssignableTo ( checkExpression ( node . expression ) , returnType ) ) {
5872
5872
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 {
6113
6113
}
6114
6114
6115
6115
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
6117
6117
continue ;
6118
6118
}
6119
6119
@@ -6965,7 +6965,7 @@ module ts {
6965
6965
return moduleType ? moduleType . symbol : undefined ;
6966
6966
}
6967
6967
6968
- // Intentinal fallthrough
6968
+ // Intentional fall-through
6969
6969
case SyntaxKind . NumericLiteral :
6970
6970
// index access
6971
6971
if ( node . parent . kind == SyntaxKind . IndexedAccess && ( < IndexedAccess > node . parent ) . index === node ) {
@@ -7030,7 +7030,7 @@ module ts {
7030
7030
var apparentType = getApparentType ( type ) ;
7031
7031
7032
7032
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
7034
7034
var propertiesByName : Map < Symbol > = { } ;
7035
7035
var results : Symbol [ ] = [ ] ;
7036
7036
@@ -7187,17 +7187,17 @@ module ts {
7187
7187
var symbol = getSymbolOfNode ( node ) ;
7188
7188
var signaturesOfSymbol = getSignaturesOfSymbol ( symbol ) ;
7189
7189
// 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
+ // }
7195
7195
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
+ // }
7201
7201
( signaturesOfSymbol . length === 1 && signaturesOfSymbol [ 0 ] . declaration !== node ) ;
7202
7202
}
7203
7203
return false ;
0 commit comments