예제 #1
0
 private static void __Execute(atom.Trace context, int level, ExportDeclaration data, string file)
 {
     context.
     SetComment("export", "[[[Data Type]]]").
     SetUrl(file, __GetLine(data, data.Pos.Value), __GetPosition(data, data.Pos.Value)).
     Send(NAME.SOURCE.PREVIEW, NAME.TYPE.PARAMETER, level, data.GetText());
 }
예제 #2
0
        private void VisitNamedExports(INamedExports nodeExportClause, ExportDeclaration exportDeclaration)
        {
            // export {A, B};
            // is translated into:
            // export {A};
            // export {B};
            for (var i = 0; i < nodeExportClause.Elements.Count; i++)
            {
                var exportSpecifier = nodeExportClause.Elements[i];

                AppendPositionDecorator(exportSpecifier);
                // @@public can be applied to export declarations.
                AppendDecorators(exportDeclaration);
                Writer.AppendToken("export").Whitespace();
                AppendNode(new NamedExports {
                    Decorators = nodeExportClause.Decorators, Elements = new NodeArray <IExportSpecifier>(exportSpecifier), Flags = nodeExportClause.Flags
                });
                AppendModuleSpecifier(exportDeclaration);

                // The last export specifier gets a separator from upstream
                if (i != nodeExportClause.Elements.Count - 1)
                {
                    AppendSeparatorIfNeeded(exportDeclaration);
                }
            }
        }
예제 #3
0
 private void AppendModuleSpecifier(ExportDeclaration node)
 {
     if (node.ModuleSpecifier != null)
     {
         Writer.Whitespace().AppendToken("from").Whitespace();
         AppendNode(node.ModuleSpecifier);
     }
 }
예제 #4
0
        private void WriteExportedAliasedDeclarations(ExportDeclaration node)
        {
            foreach (var exportSpecifier in node.ExportClause.Elements)
            {
                // Collect all aliases that the specifier points to
                var name          = exportSpecifier.PropertyName ?? exportSpecifier.Name;
                var linkedAliases = m_semanticModel.TypeChecker.CollectLinkedAliases(name);

                foreach (var linkedAlias in linkedAliases)
                {
                    WriteLinkedAlias(linkedAlias);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Export declarations can turn non-exported declarations into exported ones. So we account for those cases here.
        /// Additionally, each named specifier is given its own declaration, so positions can be kept
        /// </summary>
        /// <remarks>
        /// Observe that exports can only be top-level statements and they can only reference top level declarations. So
        /// it is always safe to print the referenced declarations in this same context.
        /// </remarks>
        public override void VisitExportDeclaration(ExportDeclaration node)
        {
            // In the case of 'export {blah}', local declarations are turned into exported ones, so we need to print them
            if (node.ExportClause != null && node.ModuleSpecifier == null)
            {
                WriteExportedAliasedDeclarations(node);
            }

            if (node.ExportClause == null)
            {
                AppendPositionDecorator(node);
                // @@public can be applied to export declarations.
                AppendDecorators(node);
                Writer.AppendToken("export").Whitespace();
                Writer.AppendToken("*");
                AppendModuleSpecifier(node); // TODO: revisit
            }
            else
            {
                VisitNamedExports(node.ExportClause, node);
            }
        }
        public void TestExportDeclaration()
        {
            ExportDeclaration node = new ExportDeclaration(GetImportOrExportClause(), GetExpression1(), DefaultLineInfo);

            CheckSerializationRoundTrip(node);
        }
예제 #7
0
 /// <nodoc />
 public virtual void Visit(ExportDeclaration exportDeclaration)
 {
 }