Example #1
0
 private void CheckBuildTrail()
 {
     if (buildTrailReadOnly == null)
     {
         buildTrailReadOnly = this.InitializeReadOnlyBuildTrail();
     }
 }
Example #2
0
 internal CliMetadataCollection(IControlledCollection <ICliMetadataCustomAttributeTableRow> sourceData, IMetadataEntity declarationPoint, _ICliManager identityManager)
 {
     this.declarationPoint = declarationPoint;
     this.sourceData       = sourceData;
     this.metadataSet      = new IMetadatum[this.Count];
     this.identityManager  = identityManager;
 }
Example #3
0
 protected virtual void Translate(IControlledCollection <IStatement> statementCollection)
 {
     foreach (var statement in statementCollection)
     {
         statement.Accept(this);
     }
 }
Example #4
0
        public CliAbstractAssemblyReferences(CliAssembly assembly)
        {
            var referenceTables = assembly.ObtainAssemblyRefTables().ToArray();
            List <ICliMetadataAssemblyRefTableRow> referenceSources    = new List <ICliMetadataAssemblyRefTableRow>();
            HashSet <IAssemblyUniqueIdentifier>    distinctIdentifiers = new HashSet <IAssemblyUniqueIdentifier>();

            foreach (var table in referenceTables)
            {
                var copy = table.ToArray();
                for (int copyIndex = 0; copyIndex < copy.Length; copyIndex++)
                {
                    var current = copy[copyIndex];
                    if (distinctIdentifiers.Add(CliCommon.GetAssemblyUniqueIdentifier(current).Item2))
                    {
                        referenceSources.Add(current);
                    }
                }
            }
            this.referenceSources = referenceSources.ToArray();
            this.identifiers      = new ArrayReadOnlyCollection <IAssemblyUniqueIdentifier>(distinctIdentifiers.ToArray());
            int mscorLib = -1;

            for (int i = 0; i < identifiers.Count; i++)
            {
                if (identifiers[i].Name == "mscorlib")
                {
                    mscorLib = i;
                    break;
                }
            }

            this.assembly   = assembly;
            this.references = new IAssembly[this.identifiers.Count];
        }
Example #5
0
        public CliFullTypeDictionary(IControlledCollection <ICliMetadataTypeDefinitionTableRow> typeDefinitions, __ICliTypeParent parent)
        {
            if (typeDefinitions is IArrayReadOnlyCollection <ICliMetadataTypeDefinitionTableRow> )
            {
                var arrayTypeDefinitions = (IArrayReadOnlyCollection <ICliMetadataTypeDefinitionTableRow>)typeDefinitions;
                if (arrayTypeDefinitions.IsAggregate)
                {
                    this.typeDefinitions = arrayTypeDefinitions.AggregateArrays.ConcatinateSeries();
                }
                else
                {
                    this.typeDefinitions = arrayTypeDefinitions.InternalArray;
                }
            }
            else if (typeDefinitions != null)
            {
                this.typeDefinitions = typeDefinitions.ToArray();
            }
            else
            {
                this.typeDefinitions = new ICliMetadataTypeDefinitionTableRow[0];
            }
            int len = this.typeDefinitions.Length;

            this.resultTypes = new IType[len];
            this.resultKinds = new TypeKind[len];
            this.resultKeys  = new IGeneralTypeUniqueIdentifier[len];
            this.parent      = parent;
        }
 internal ReadOnlyWrapper(IControlledCollection <T> source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     this.source = source;
 }
Example #7
0
 public CovariantReadOnlyCollection(IControlledCollection <THigher> covariantSource)
 {
     if (covariantSource == null)
     {
         throw new ArgumentNullException("covariantSource");
     }
     this.covariantSource = covariantSource;
 }
Example #8
0
 internal void Initialize(IControlledCollection <TMetadata> collection)
 {
     if (collection == null) /* If we get 'nothing' from the metadata */
     {
         collection = new ControlledCollection <TMetadata>(new TMetadata[0]);
     }
     this.metadataCollection = collection;
     this.state           = METADATA_SOURCE_COLLECTION;
     this.declarationData = new TDeclaration[collection.Count];
 }
Example #9
0
        //#endregion

        //#region IDisposable Members

        public void Dispose()
        {
            for (int i = 0; i < this.Count; i++)
            {
                this.declarationData[i].Dispose();
            }
            this.declarationData    = null;
            this.metadataSource     = null;
            this.metadataCollection = null;
        }
Example #10
0
 public bool IsBrokeFull(IControlledCollection <IStatement> series, TContext context)
 {
     foreach (var blockStatement in series)
     {
         if (blockStatement.Accept(this, context))
         {
             return(true);
         }
     }
     return(false);
 }
        public GrammarBreakdown(IGrammarSymbol[] symbols)
        {
            /* *
             * Obtain a sequence of the elements which are constant items within a series of other constants (i.e.: enum field members.)
             * */
            var symbolSets = (from symbol in symbols
                              let itemSymbol = symbol as IGrammarConstantItemSymbol
                                               where itemSymbol != null
                                               select itemSymbol).ToArray();
            //Obtain the distinct container tokens.
            var tokenSets = (from symbol in symbolSets
                             select symbol.Source).Distinct().ToArray();

            /* *
             * Obtain the container tokens along with the individual elements within them relative to the symbols provided.
             * */
            var tokenSymbolSets = from entry in tokenSets
                                  join itemSymbol in symbolSets on entry equals itemSymbol.Source into entrySymbols
                                  select new { Entry = entry, Items = entrySymbols.ToArray() };
            //Obtain the tokens which are just a constant by themselves.
            var constantEntries = (from symbol in symbols
                                   let constantEntry = symbol as IGrammarConstantEntrySymbol
                                                       where constantEntry != null
                                                       select constantEntry).ToArray();
            //Obtain the rules within the symbols.
            var ruleEntries = (from symbol in symbols
                               let ruleEntry = symbol as IGrammarRuleSymbol
                                               where ruleEntry != null
                                               select ruleEntry).ToArray();
            //Obtain the capture-style token symbols.
            var tokenEntries = (from symbol in symbols
                                let tokenEntry = symbol as IGrammarTokenSymbol
                                                 where tokenEntry != null &&
                                                 (!(tokenEntry is IGrammarConstantEntrySymbol)) &&
                                                 (!(tokenEntry is IGrammarConstantItemSymbol))
                                                 select tokenEntry).ToArray();
            var literalSeriesTokens = new Dictionary <IOilexerGrammarTokenEntry, TokenElements>();

            foreach (var tokenSymbolSet in tokenSymbolSets)
            {
                literalSeriesTokens.Add(tokenSymbolSet.Entry, new TokenElements(tokenSymbolSet.Items));
            }
            this.LiteralSeriesTokens = new ControlledDictionary <IOilexerGrammarTokenEntry, TokenElements>(literalSeriesTokens);
            ConstantTokens           = new ControlledCollection <IGrammarConstantEntrySymbol>(constantEntries);
            CaptureTokens            = new ControlledCollection <IGrammarTokenSymbol>(tokenEntries);
            Rules  = new ControlledCollection <IGrammarRuleSymbol>(ruleEntries);
            Tokens = new ControlledCollection <IOilexerGrammarTokenEntry>((
                                                                              from constant in ConstantTokens
                                                                              select constant.Source).Concat(
                                                                              from captureToken in CaptureTokens
                                                                              select captureToken.Source).Concat(
                                                                              from literalToken in LiteralSeriesTokens.Keys
                                                                              select literalToken).Distinct().ToArray());
        }
Example #12
0
 public override void Dispose()
 {
     if (this.versions != null)
     {
         foreach (var version in this.versions)
         {
             version.Dispose();
         }
         this.versions = null;
     }
     base.Dispose();
 }
Example #13
0
 public CliMetadataMethodSpecSignature(ICliMetadataTypeSignature[] genericParameters)
     : base()
 {
     if (genericParameters == null || genericParameters.Length == 0)
     {
         this.GenericParameters = ArrayReadOnlyCollection <ICliMetadataTypeSignature> .Empty;
     }
     else
     {
         this.GenericParameters = new ArrayReadOnlyCollection <ICliMetadataTypeSignature>(genericParameters);
     }
 }
Example #14
0
        /// <summary>
        /// Creates a new <see cref="SoftTemplateReferenceProductionRuleItem"/> instance
        /// with the <paramref name="serii"/>, <paramref name="primaryName"/>,
        /// <paramref name="line"/>, <paramref name="column"/>, and <paramref name="position"/>
        /// provided.
        /// </summary>
        /// <param name="primaryName">The token, declaration rule, or error that the <see cref="SoftTemplateReferenceProductionRuleItem"/>
        /// refers to.</param>
        /// <param name="line">The line at which the <see cref="SoftTemplateReferenceProductionRuleItem"/> was defined.</param>
        /// <param name="column">The column on <paramref name="line"/> at which the <see cref="SoftTemplateReferenceProductionRuleItem"/> was
        /// defined.</param>
        /// <param name="position">The byte in the file at which the <see cref="SoftTemplateReferenceProductionRuleItem"/> was declared.</param>
        /// <remarks><paramref name="secondaryName"/> does not relate to errors because
        /// errors have no members.</remarks>
        public SoftTemplateReferenceProductionRuleItem(IList <IProductionRule>[] serii, string primaryName, int line, int column, long position)
            : base(primaryName, null, line, column, position, false, false)
        {
            IList <IProductionRuleSeries> parts = new List <IProductionRuleSeries>();

            foreach (IList <IProductionRule> c in serii)
            {
                parts.Add(new OilexerGrammarSeriesEntry(c));
            }

            this.parts = new ControlledCollection <IProductionRuleSeries>(parts);
        }
Example #15
0
        public void CopyTo(TItem[] array, int arrayIndex = 0)
        {
            IControlledCollection current = this.collections[0];

            for (int i = 0, offset = 0, len = this.collections.Length; i < this.collections.Length; current = (i + 1) < len ? this.collections[++i] : null, offset += current.Count)
            {
                if (offset + current.Count > array.Length)
                {
                    throw ThrowHelper.ObtainArgumentException(ArgumentWithException.array, ExceptionMessageId.InsufficientSpaceForCopy, ThrowHelper.GetArgumentName(ArgumentWithException.array));
                }
                current.CopyTo(array, offset);
            }
        }
Example #16
0
 internal virtual void PushModuleTypes(ICliMetadataTypeDefinitionTableRow[] namespaceTypes)
 {
     if (this._Types == null)
     {
         this._Types = new ArrayReadOnlyCollection <ICliMetadataTypeDefinitionTableRow>(namespaceTypes);
     }
     else
     {
         int len  = this._Types.Count;
         var copy = this._Types.ToArray().EnsureMinimalSpaceExists((uint)len, (uint)namespaceTypes.Length, (uint)(len + namespaceTypes.Length));
         namespaceTypes.CopyTo(copy, len);
         Array.Sort <ICliMetadataTypeDefinitionTableRow>(copy, CliAssembly._CompareTo_);
         this._Types = new ArrayReadOnlyCollection <ICliMetadataTypeDefinitionTableRow>(copy);
     }
 }
Example #17
0
 internal ArrayType(IType elementType, CliManager manager, int[] lowerBounds, uint[] lengths, int rank = -1)
 {
     this.elementType = elementType;
     this.lowerBounds = new ArrayReadOnlyCollection <int>(lowerBounds ?? new int[0]);
     this.lengths     = new ArrayReadOnlyCollection <uint>(lengths ?? new uint[0]);
     this.rank        = rank < 0 ?
                        Math.Max(
         lowerBounds == null ?
         0 :
         lowerBounds.Length,
         lengths == null ?
         0 :
         lengths.Length) :
                        rank;
     this.manager = manager;
 }
Example #18
0
 public void Dispose()
 {
     lock (this.syncObject)
     {
         for (int metadatumIndex = 0, count = this.Count; metadatumIndex < count; metadatumIndex++)
         {
             var current = this.metadataSet[metadatumIndex];
             if (current != null)
             {
                 current.Dispose();
             }
         }
     }
     this.metadataSet = null;
     this.sourceData  = null;
 }
Example #19
0
 public CliModifiedType(IType original, IControlledCollection <ICliMetadataCustomModifierSignature> modifiers)
 {
     this.original  = original;
     this.modifiers = modifiers;
 }
Example #20
0
 /// <summary>
 /// Creates a new <see cref="CliMetadataLazySet{T}"/> with the
 /// <paramref name="indices"/> provided.
 /// </summary>
 /// <param name="indices">The <see cref="UInt32"/> array</param>
 public CliMetadataLazySequentialSet(uint initialIndex, uint followIndex, IControlledCollection <T> owningTable)
 {
     this.startingIndex = initialIndex;
     this.count         = (int)(followIndex - initialIndex);
     this.owningTable   = owningTable;
 }
Example #21
0
 internal CliNamespaceKeyedTree(ICliMetadataTypeDefinitionTableRow[] namespaceTypes)
 {
     this._Types = new ArrayReadOnlyCollection <ICliMetadataTypeDefinitionTableRow>(namespaceTypes);
 }
Example #22
0
 public static IControlledCollection <TLower> GetCovariant <TLower, THigher>(this IControlledCollection <THigher> source)
     where THigher :
 TLower
 {
     return(new CovariantReadOnlyCollection <TLower, THigher>(source));
 }
Example #23
0
 protected CliMetadataDrivenDictionary(IControlledCollection <TMetadata> metadata)
 {
     this.Initialize(metadata);
 }
Example #24
0
 public ModifiedType(IType original, TypeModification[] modifiers)
 {
     this.original  = original;
     this.modifiers = new ArrayReadOnlyCollection <TypeModification>(modifiers);
 }
Example #25
0
 public ModifierCollection(IControlledCollection <ICliMetadataCustomModifierSignature> modifierCollection)
 {
     this.dataSource = modifierCollection;
     this.dataCopy   = new IType[modifierCollection.Count];
 }
Example #26
0
 internal CliGenericParameterDictionary(IControlledCollection <ICliMetadataGenericParameterTableRow> genericParameters, TParent parent)
     : base()
 {
     this.parent = parent;
     base.Initialize(genericParameters);
 }
Example #27
0
 /// <summary>
 /// Creates a new <see cref="CliMetadataLazySet{T}"/> with the
 /// <paramref name="indices"/> provided.
 /// </summary>
 /// <param name="indices">The <see cref="UInt32"/> array</param>
 public CliMetadataLazySet(uint[] indices, IControlledCollection <T> owningTable)
 {
     this.indices     = indices;
     this.owningTable = owningTable;
 }