protected override void VisitExportDefaultDeclaration(ExportDefaultDeclaration exportDefaultDeclaration)
            {
                switch (exportDefaultDeclaration.Declaration)
                {
                case FunctionDeclaration functionDeclaration when functionDeclaration.Id != null:
                    _substitutions.Add(exportDefaultDeclaration.Range, GetContentSegment(_module.Content, functionDeclaration.Range));
                    break;

                case ClassDeclaration classDeclaration when classDeclaration.Id != null:
                    _substitutions.Add(exportDefaultDeclaration.Range, GetContentSegment(_module.Content, classDeclaration.Range));
                    break;

                default:
                    _substitutions.Add(exportDefaultDeclaration.Range, StringSegment.Empty);
                    break;
                }
            }
Beispiel #2
0
        private void ExtractExports(ModuleData module, ExportDefaultDeclaration defaultDeclaration)
        {
            switch (defaultDeclaration.Declaration)
            {
            case FunctionDeclaration functionDeclaration when functionDeclaration.Id != null:
                // export default function myFunc() {}
                module.ExportsRaw.Add(new NamedExportData(DefaultExportName, functionDeclaration.Id.Name));
                break;

            case ClassDeclaration classDeclaration when classDeclaration.Id != null:
                // export default class MyClass {}
                module.ExportsRaw.Add(new NamedExportData(DefaultExportName, classDeclaration.Id.Name));
                break;

            default:
                // export default function() { }
                // export default class { }
                // export default <expression>;
                module.ExportsRaw.Add(new DefaultExpressionExportData(defaultDeclaration.Declaration));
                break;
            }
        }
Beispiel #3
0
 public virtual void VisitExportDefaultDeclaration(ExportDefaultDeclaration exportDefaultDeclaration)
 {
 }
Beispiel #4
0
 protected virtual void VisitExportDefaultDeclaration(ExportDefaultDeclaration exportDefaultDeclaration)
 {
 }
Beispiel #5
0
 protected override void VisitExportDefaultDeclaration(ExportDefaultDeclaration exportDefaultDeclaration)
 {
     using (StartNodeObject(exportDefaultDeclaration))
         Member("declaration", exportDefaultDeclaration.Declaration.As <INode>());
 }
Beispiel #6
0
 protected internal override void VisitExportDefaultDeclaration(ExportDefaultDeclaration exportDefaultDeclaration)
 {
     VisitingExportDefaultDeclaration?.Invoke(this, exportDefaultDeclaration);
     base.VisitExportDefaultDeclaration(exportDefaultDeclaration);
     VisitedExportDefaultDeclaration?.Invoke(this, exportDefaultDeclaration);
 }
Beispiel #7
0
 private Ust VisitExportDefaultDeclaration(ExportDefaultDeclaration exportDefaultDeclaration)
 {
     // TODO: fix export default declaration
     return(VisitDeclaration(exportDefaultDeclaration.Declaration));
 }