public EntryPublicationReferenceSymbol(
     EntrySymbol containingSymbol,
     EntryBaseNode declaration,
     DiagnosticBag diagnostics)
 {
     Declaration = declaration;
     if (Declaration.PublicationId is null)
     {
         // that's not what should happen, if publicationId is null,
         // the containing symbol should set its IPublicationRefernceSymbol property to null
         diagnostics.Add(
             ErrorCode.ERR_GenericError,
             Declaration.GetLocation(),
             ImmutableArray.Create <Symbol>(this));
     }
     this.containingSymbol = containingSymbol;
 }
Пример #2
0
    public static ImmutableArray <IEffectSymbol> CreateEffects(
        EntrySymbol containingSymbol,
        EntryBaseNode declaration,
        DiagnosticBag diagnostics)
    {
        return(CreateChildEffects().ToImmutableArray());

        IEnumerable <IEffectSymbol> CreateChildEffects()
        {
            foreach (var item in declaration.Modifiers)
            {
                yield return(CreateEffect(containingSymbol, item, diagnostics));
            }
            foreach (var item in declaration.ModifierGroups)
            {
                yield return(CreateEffect(containingSymbol, item, diagnostics));
            }
        }
    }
Пример #3
0
    protected CatalogueBaseSymbol(
        SourceGlobalNamespaceSymbol containingSymbol,
        CatalogueBaseNode declaration,
        DiagnosticBag diagnostics)
        : base(containingSymbol, declaration)
    {
        ContainingNamespace            = containingSymbol;
        Declaration                    = declaration;
        costTypes                      = declaration.CostTypes.Select(x => new CostTypeSymbol(this, x, diagnostics)).ToImmutableArray();
        profileTypes                   = declaration.ProfileTypes.Select(x => new ProfileTypeSymbol(this, x, diagnostics)).ToImmutableArray();
        publications                   = declaration.Publications.Select(x => new PublicationSymbol(this, x, diagnostics)).ToImmutableArray();
        RootContainerEntries           = CreateRootContainerEntries().ToImmutableArray();
        RootResourceEntries            = CreateRootResourceEntries().ToImmutableArray();
        SharedSelectionEntryContainers = CreateSharedContainerEntries().ToImmutableArray();
        SharedResourceEntries          = CreateSharedResourceEntries().ToImmutableArray();

        IEnumerable <IContainerEntrySymbol> CreateRootContainerEntries()
        {
            foreach (var item in declaration.SelectionEntries)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
            foreach (var item in declaration.EntryLinks)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
            foreach (var item in declaration.ForceEntries)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
            foreach (var item in declaration.CategoryEntries)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
        }

        IEnumerable <IResourceEntrySymbol> CreateRootResourceEntries()
        {
            foreach (var item in declaration.Rules)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
        }

        IEnumerable <ISelectionEntryContainerSymbol> CreateSharedContainerEntries()
        {
            foreach (var item in declaration.SharedSelectionEntries)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
            foreach (var item in declaration.SharedSelectionEntryGroups)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
        }

        IEnumerable <IResourceEntrySymbol> CreateSharedResourceEntries()
        {
            foreach (var item in declaration.SharedInfoGroups)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
            foreach (var item in declaration.SharedProfiles)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
            foreach (var item in declaration.SharedRules)
            {
                yield return(EntrySymbol.CreateEntry(this, item, diagnostics));
            }
        }
    }