function checkTypeParameters(typeParameterDeclarations) {
            if (typeParameterDeclarations) {
                for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) {
                    var node = typeParameterDeclarations[i];
                    checkTypeParameter(node);
                    if (produceDiagnostics) {
                        for (var j = 0; j < i; j++) {
                            if (typeParameterDeclarations[j].symbol === node.symbol) {
                                error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));
                            }
                        }
                    }
                }
            }
        }

function checkTypeParameters ( typeParameterDeclarations ) { if ( typeParameterDeclarations ) { for ( var i = 0 , n = typeParameterDeclarations . length ; i < n ; i ++ ) { var node = typeParameterDeclarations [ i ] ; checkTypeParameter ( node ) ; if ( produceDiagnostics ) { for ( var j = 0 ; j < i ; j ++ ) { if ( typeParameterDeclarations [ j ] . symbol === node . symbol ) { error ( node . name , ts . Diagnostics . Duplicate_identifier_0 , ts . declarationNameToString ( node . name ) ) ; } } } } } }

Check each type parameter and check that list has no duplicate type parameter declarations


function checkSourceFileWorker(node) {
            var links = getNodeLinks(node);
            if (!(links.flags & 1 /* TypeChecked */)) {
                // Check whether the file has declared it is the default lib,
                // and whether the user has specifically chosen to avoid checking it.
                if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) {
                    return;
                }
                // Grammar checking
                checkGrammarSourceFile(node);
                emitExtends = false;
                emitDecorate = false;
                emitParam = false;
                potentialThisCollisions.length = 0;
                ts.forEach(node.statements, checkSourceElement);
                checkFunctionAndClassExpressionBodies(node);
                if (ts.isExternalModule(node)) {
                    checkExternalModuleExports(node);
                }
                if (potentialThisCollisions.length) {
                    ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);
                    potentialThisCollisions.length = 0;
                }
                if (emitExtends) {
                    links.flags |= 8 /* EmitExtends */;
                }
                if (emitDecorate) {
                    links.flags |= 16 /* EmitDecorate */;
                }
                if (emitParam) {
                    links.flags |= 32 /* EmitParam */;
                }
                if (emitAwaiter) {
                    links.flags |= 64 /* EmitAwaiter */;
                }
                if (emitGenerator || (emitAwaiter && languageVersion < 2 /* ES6 */)) {
                    links.flags |= 128 /* EmitGenerator */;
                }
                links.flags |= 1 /* TypeChecked */;
            }
        }

function checkSourceFileWorker ( node ) { var links = getNodeLinks ( node ) ; if ( ! ( links . flags & 1 ) ) { if ( node . isDefaultLib && compilerOptions . skipDefaultLibCheck ) { return ; } checkGrammarSourceFile ( node ) ; emitExtends = false ; emitDecorate = false ; emitParam = false ; potentialThisCollisions . length = 0 ; ts . forEach ( node . statements , checkSourceElement ) ; checkFunctionAndClassExpressionBodies ( node ) ; if ( ts . isExternalModule ( node ) ) { checkExternalModuleExports ( node ) ; } if ( potentialThisCollisions . length ) { ts . forEach ( potentialThisCollisions , checkIfThisIsCapturedInEnclosingScope ) ; potentialThisCollisions . length = 0 ; } if ( emitExtends ) { links . flags |= 8 ; } if ( emitDecorate ) { links . flags |= 16 ; } if ( emitParam ) { links . flags |= 32 ; } if ( emitAwaiter ) { links . flags |= 64 ; } if ( emitGenerator || ( emitAwaiter && languageVersion < 2 ) ) { links . flags |= 128 ; } links . flags |= 1 ; } }

Fully type check a source file and collect the relevant diagnostics.

Fully type check a source file and collect the relevant diagnostics .


function copySymbol(symbol, meaning) {
                if (symbol.flags & meaning) {
                    var id = symbol.name;
                    // We will copy all symbol regardless of its reserved name because
                    // symbolsToArray will check whether the key is a reserved name and
                    // it will not copy symbol with reserved name to the array
                    if (!ts.hasProperty(symbols, id)) {
                        symbols[id] = symbol;
                    }
                }
            }

function copySymbol ( symbol , meaning ) { if ( symbol . flags & meaning ) { var id = symbol . name ; if ( ! ts . hasProperty ( symbols , id ) ) { symbols [ id ] = symbol ; } } }

Copy the given symbol into symbol tables if the symbol has the given meaning
and it doesn't already existed in the symbol table
@param key a key for storing in symbol table; if undefined, use symbol.name
@param symbol the symbol to be added into symbol table
@param meaning meaning of symbol to filter by before adding to symbol table

Copy the given symbol into symbol tables if the symbol has the given meaning and it doesn t already existed in the symbol table


function getParentTypeOfClassElement(node) {
            var classSymbol = getSymbolOfNode(node.parent);
            return node.flags & 128 /* Static */
                ? getTypeOfSymbol(classSymbol)
                : getDeclaredTypeOfSymbol(classSymbol);
        }

function getParentTypeOfClassElement ( node ) { var classSymbol = getSymbolOfNode ( node . parent ) ; return node . flags & 128 ? getTypeOfSymbol ( classSymbol ) : getDeclaredTypeOfSymbol ( classSymbol ) ; }

Gets either the static or instance type of a class element, based on
whether the element is declared as "static".

Gets either the static or instance type of a class element based on whether the element is declared as static .


function getAugmentedPropertiesOfType(type) {
            type = getApparentType(type);
            var propsByName = createSymbolTable(getPropertiesOfType(type));
            if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) {
                ts.forEach(getPropertiesOfType(globalFunctionType), function (p) {
                    if (!ts.hasProperty(propsByName, p.name)) {
                        propsByName[p.name] = p;
                    }
                });
            }
            return getNamedMembers(propsByName);
        }

function getAugmentedPropertiesOfType ( type ) { type = getApparentType ( type ) ; var propsByName = createSymbolTable ( getPropertiesOfType ( type ) ) ; if ( getSignaturesOfType ( type , 0 ) . length || getSignaturesOfType ( type , 1 ) . length ) { ts . forEach ( getPropertiesOfType ( globalFunctionType ) , function ( p ) { if ( ! ts . hasProperty ( propsByName , p . name ) ) { propsByName [ p . name ] = p ; } } ) ; } return getNamedMembers ( propsByName ) ; }

Return the list of properties of the given type, augmented with properties from Function if the type has call or construct signatures

Return the list of properties of the given type augmented with properties from Function if the type has call or construct signatures


function getReferencedExportContainer(node) {
            var symbol = getReferencedValueSymbol(node);
            if (symbol) {
                if (symbol.flags & 1048576 /* ExportValue */) {
                    // If we reference an exported entity within the same module declaration, then whether
                    // we prefix depends on the kind of entity. SymbolFlags.ExportHasLocal encompasses all the
                    // kinds that we do NOT prefix.
                    var exportSymbol = getMergedSymbol(symbol.exportSymbol);
                    if (exportSymbol.flags & 944 /* ExportHasLocal */) {
                        return undefined;
                    }
                    symbol = exportSymbol;
                }
                var parentSymbol = getParentOfSymbol(symbol);
                if (parentSymbol) {
                    if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 248 /* SourceFile */) {
                        return parentSymbol.valueDeclaration;
                    }
                    for (var n = node.parent; n; n = n.parent) {
                        if ((n.kind === 218 /* ModuleDeclaration */ || n.kind === 217 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) {
                            return n;
                        }
                    }
                }
            }
        }

function getReferencedExportContainer ( node ) { var symbol = getReferencedValueSymbol ( node ) ; if ( symbol ) { if ( symbol . flags & 1048576 ) { var exportSymbol = getMergedSymbol ( symbol . exportSymbol ) ; if ( exportSymbol . flags & 944 ) { return undefined ; } symbol = exportSymbol ; } var parentSymbol = getParentOfSymbol ( symbol ) ; if ( parentSymbol ) { if ( parentSymbol . flags & 512 && parentSymbol . valueDeclaration . kind === 248 ) { return parentSymbol . valueDeclaration ; } for ( var n = node . parent ; n ; n = n . parent ) { if ( ( n . kind === 218 || n . kind === 217 ) && getSymbolOfNode ( n ) === parentSymbol ) { return n ; } } } } }

Emitter support When resolved as an expression identifier, if the given node references an exported entity, return the declaration node of the exported entity's container. Otherwise, return undefined.

Emitter support When resolved as an expression identifier if the given node references an exported entity return the declaration node of the exported entity s container . Otherwise return undefined .


function getReferencedImportDeclaration(node) {
            var symbol = getReferencedValueSymbol(node);
            return symbol && symbol.flags & 8388608 /* Alias */ ? getDeclarationOfAliasSymbol(symbol) : undefined;
        }

function getReferencedImportDeclaration ( node ) { var symbol = getReferencedValueSymbol ( node ) ; return symbol && symbol . flags & 8388608 ? getDeclarationOfAliasSymbol ( symbol ) : undefined ; }

When resolved as an expression identifier, if the given node references an import, return the declaration of that import. Otherwise, return undefined.

When resolved as an expression identifier if the given node references an import return the declaration of that import . Otherwise return undefined .


function getReferencedNestedRedeclaration(node) {
            var symbol = getReferencedValueSymbol(node);
            return symbol && isNestedRedeclarationSymbol(symbol) ? symbol.valueDeclaration : undefined;
        }

function getReferencedNestedRedeclaration ( node ) { var symbol = getReferencedValueSymbol ( node ) ; return symbol && isNestedRedeclarationSymbol ( symbol ) ? symbol . valueDeclaration : undefined ; }

When resolved as an expression identifier, if the given node references a nested block scoped entity with a name that hides an existing name, return the declaration of that entity. Otherwise, return undefined.

When resolved as an expression identifier if the given node references a nested block scoped entity with a name that hides an existing name return the declaration of that entity . Otherwise return undefined .


function getExportDefaultTempVariableName() {
            var baseName = "_default";
            if (!ts.hasProperty(currentSourceFile.identifiers, baseName)) {
                return baseName;
            }
            var count = 0;
            while (true) {
                var name_18 = baseName + "_" + (++count);
                if (!ts.hasProperty(currentSourceFile.identifiers, name_18)) {
                    return name_18;
                }
            }
        }

function getExportDefaultTempVariableName ( ) { var baseName = "_default" ; if ( ! ts . hasProperty ( currentSourceFile . identifiers , baseName ) ) { return baseName ; } var count = 0 ; while ( true ) { var name_18 = baseName + "_" + ( ++ count ) ; if ( ! ts . hasProperty ( currentSourceFile . identifiers , name_18 ) ) { return name_18 ; } } }

Return a temp variable name to be used in `export default` statements. The temp name will be of the form _default_counter. Note that export default is only allowed at most once in a module, so we do not need to keep track of created temp names.

Return a temp variable name to be used in export default statements . The temp name will be of the form _default_counter . Note that export default is only allowed at most once in a module so we do not need to keep track of created temp names .