public ExportNamedDeclaration(IStatementListItem declaration, NodeList <ExportSpecifier> specifiers, Literal source) :
     base(Nodes.ExportNamedDeclaration)
 {
     Declaration = declaration;
     Specifiers  = specifiers;
     Source      = source;
 }
Exemple #2
0
        private void ExtractExports(ModuleData module, IStatementListItem exportDeclaration)
        {
            switch (exportDeclaration)
            {
            case VariableDeclaration variableDeclaration:
                for (int i = 0, n = variableDeclaration.Declarations.Count; i < n; i++)
                {
                    switch (variableDeclaration.Declarations[i].Id)
                    {
                    case Identifier identifier:
                        module.ExportsRaw.Add(new NamedExportData(identifier.Name));
                        break;

                    case ArrayPattern arrayPattern:
                        ExtractVariableExports(module, arrayPattern);
                        break;

                    case ObjectPattern objectPattern:
                        ExtractVariableExports(module, objectPattern);
                        break;
                    }
                }
                break;

            case FunctionDeclaration functionDeclaration:
                module.ExportsRaw.Add(new NamedExportData(functionDeclaration.Id.Name));
                break;

            case ClassDeclaration classDeclaration:
                module.ExportsRaw.Add(new NamedExportData(classDeclaration.Id.Name));
                break;
            }
        }
Exemple #3
0
 public ExportNamedDeclaration(
     IStatementListItem declaration,
     in NodeList <ExportSpecifier> specifiers,