Esempio n. 1
0
        private void AnalyzeDeclarationStatement(IStatement source, int idx)
        {
            // We don't need to analyze injected declarations (e.g. withQualifier or qualifier declarations)
            if (source.IsInjectedForDScript())
            {
                return;
            }

            switch (source.Kind)
            {
            case SyntaxKind.InterfaceDeclaration:
                AnalyzeInterfaceDeclaration(source.Cast <IInterfaceDeclaration>());
                break;

            case SyntaxKind.ImportDeclaration:
                AnalyzeImportDeclaration(source.Cast <IImportDeclaration>());
                break;

            case SyntaxKind.ExportDeclaration:
                AnalyzeExportDeclaration(source.Cast <IExportDeclaration>());
                break;

            case SyntaxKind.ModuleDeclaration:
                AnalyzeNamespaceDeclaration(source.Cast <IModuleDeclaration>());
                break;

            case SyntaxKind.VariableStatement:
                AnalyzeTopLevelVariableDeclarations(
                    source.Cast <IVariableStatement>().DeclarationList,
                    GetModifiers(source.Cast <IVariableStatement>()),
                    idx);
                break;

            case SyntaxKind.FunctionDeclaration:
                AnalyzeFunctionDeclaration(source.Cast <IFunctionDeclaration>());
                break;

            case SyntaxKind.EnumDeclaration:
                AnalyzeEnumDeclaration(source.Cast <IEnumDeclaration>());
                break;

            case SyntaxKind.TypeAliasDeclaration:
                AnalyzeTypeAlias(source.Cast <ITypeAliasDeclaration>());
                break;
            }
        }
Esempio n. 2
0
        private void AnalyzeStatement([CanBeNull] IStatement statement, int idx)
        {
            if (statement == null)
            {
                return;
            }

            switch (statement.Kind)
            {
            case SyntaxKind.VariableStatement:
                AnalyzeVariableStatement(statement.Cast <IVariableStatement>().DeclarationList, idx);
                break;

            case SyntaxKind.FunctionDeclaration:
                AnalyzeLocalFunctionDeclaration(statement.Cast <IFunctionDeclaration>(), idx);
                break;

            case SyntaxKind.IfStatement:
                AnalyzeIfStatement(statement.Cast <IIfStatement>(), idx);
                break;

            case SyntaxKind.ReturnStatement:
                AnalyzeReturnStatement(statement.Cast <IReturnStatement>(), idx);
                break;

            case SyntaxKind.SwitchStatement:
                AnalyzeSwitchStatement(statement.Cast <ISwitchStatement>(), idx);
                break;

            case SyntaxKind.Block:
                AnalyzeBlock(statement.Cast <IBlock>());
                break;

            case SyntaxKind.ForOfStatement:
                AnalyzeForOfStatement(statement.Cast <IForOfStatement>(), idx);
                break;

            case SyntaxKind.ForInStatement:
                AnalyzeForInStatement(statement.Cast <IForInStatement>(), idx);
                break;

            case SyntaxKind.ForStatement:
                AnalyzeForStatement(statement.Cast <IForStatement>(), idx);
                break;

            case SyntaxKind.WhileStatement:
                AnalyzeWhileStatement(statement.Cast <IWhileStatement>(), idx);
                break;

            case SyntaxKind.ExpressionStatement:
                AnalyzeExpressionStatement(statement.Cast <IExpressionStatement>(), idx);
                break;
            }
        }