Exemplo n.º 1
0
        private static SyntaxTreeIndex?ReadFrom(
            StringTable stringTable,
            ObjectReader reader,
            Checksum?checksum
            )
        {
            var literalInfo         = LiteralInfo.TryReadFrom(reader);
            var identifierInfo      = IdentifierInfo.TryReadFrom(reader);
            var contextInfo         = ContextInfo.TryReadFrom(reader);
            var declarationInfo     = DeclarationInfo.TryReadFrom(stringTable, reader);
            var extensionMethodInfo = ExtensionMethodInfo.TryReadFrom(reader);

            if (
                literalInfo == null ||
                identifierInfo == null ||
                contextInfo == null ||
                declarationInfo == null ||
                extensionMethodInfo == null
                )
            {
                return(null);
            }

            return(new SyntaxTreeIndex(
                       checksum,
                       literalInfo.Value,
                       identifierInfo.Value,
                       contextInfo.Value,
                       declarationInfo.Value,
                       extensionMethodInfo.Value
                       ));
        }
        private TopLevelSyntaxTreeIndex(
            Checksum?checksum,
            DeclarationInfo declarationInfo,
            ExtensionMethodInfo extensionMethodInfo)
            : base(checksum)
        {
            _declarationInfo     = declarationInfo;
            _extensionMethodInfo = extensionMethodInfo;

            _declaredSymbolInfoSet = new(() => new(this.DeclaredSymbolInfos));
        }
Exemplo n.º 3
0
 private SyntaxTreeIndex(
     Checksum checksum,
     LiteralInfo literalInfo,
     IdentifierInfo identifierInfo,
     ContextInfo contextInfo,
     DeclarationInfo declarationInfo,
     ExtensionMethodInfo extensionMethodInfo)
 {
     this.Checksum        = checksum;
     _literalInfo         = literalInfo;
     _identifierInfo      = identifierInfo;
     _contextInfo         = contextInfo;
     _declarationInfo     = declarationInfo;
     _extensionMethodInfo = extensionMethodInfo;
 }
Exemplo n.º 4
0
 private SyntaxTreeIndex(
     Checksum?checksum,
     LiteralInfo literalInfo,
     IdentifierInfo identifierInfo,
     ContextInfo contextInfo,
     DeclarationInfo declarationInfo,
     ExtensionMethodInfo extensionMethodInfo)
 {
     this.Checksum          = checksum;
     _literalInfo           = literalInfo;
     _identifierInfo        = identifierInfo;
     _contextInfo           = contextInfo;
     _declarationInfo       = declarationInfo;
     _extensionMethodInfo   = extensionMethodInfo;
     _declaredSymbolInfoSet = new(() => new(this.DeclaredSymbolInfos));
 }
Exemplo n.º 5
0
        private static TopLevelSyntaxTreeIndex?ReadIndex(
            StringTable stringTable, ObjectReader reader, Checksum?checksum)
        {
            var declarationInfo     = DeclarationInfo.TryReadFrom(stringTable, reader);
            var extensionMethodInfo = ExtensionMethodInfo.TryReadFrom(reader);

            if (declarationInfo == null || extensionMethodInfo == null)
            {
                return(null);
            }

            return(new TopLevelSyntaxTreeIndex(
                       checksum,
                       declarationInfo.Value,
                       extensionMethodInfo.Value));
        }
Exemplo n.º 6
0
        private static SyntaxTreeIndex?ReadFrom(
            StringTable stringTable, ObjectReader reader, Checksum?checksum)
        {
            var literalInfo         = LiteralInfo.TryReadFrom(reader);
            var identifierInfo      = IdentifierInfo.TryReadFrom(reader);
            var contextInfo         = ContextInfo.TryReadFrom(reader);
            var declarationInfo     = DeclarationInfo.TryReadFrom(stringTable, reader);
            var extensionMethodInfo = ExtensionMethodInfo.TryReadFrom(reader);

            if (literalInfo == null || identifierInfo == null || contextInfo == null || declarationInfo == null || extensionMethodInfo == null)
            {
                return(null);
            }

            var globalAliasInfoCount = reader.ReadInt32();
            HashSet <(string alias, string name, int arity)>?globalAliasInfo = null;

            if (globalAliasInfoCount > 0)
            {
                globalAliasInfo = new HashSet <(string alias, string name, int arity)>();

                for (var i = 0; i < globalAliasInfoCount; i++)
                {
                    var alias = reader.ReadString();
                    var name  = reader.ReadString();
                    var arity = reader.ReadInt32();
                    globalAliasInfo.Add((alias, name, arity));
                }
            }

            return(new SyntaxTreeIndex(
                       checksum,
                       literalInfo.Value,
                       identifierInfo.Value,
                       contextInfo.Value,
                       declarationInfo.Value,
                       extensionMethodInfo.Value,
                       globalAliasInfo));
        }