Example #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (descriptorSetCase_ == DescriptorSetOneofCase.ProtoDescriptor)
            {
                hash ^= ProtoDescriptor.GetHashCode();
            }
            if (descriptorSetCase_ == DescriptorSetOneofCase.ProtoDescriptorBin)
            {
                hash ^= ProtoDescriptorBin.GetHashCode();
            }
            hash ^= services_.GetHashCode();
            if (printOptions_ != null)
            {
                hash ^= PrintOptions.GetHashCode();
            }
            if (MatchIncomingRequestRoute != false)
            {
                hash ^= MatchIncomingRequestRoute.GetHashCode();
            }
            hash ^= (int)descriptorSetCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        private static void VerifyVisitor(ProtoDescriptor descriptor, VisitorVerificationAction verify = null)
        {
            // ReSharper disable once RedundantEmptyObjectOrCollectionInitializer
            var visitor = new CodeGenerationProtoDescriptorVisitor {
            };

            visitor.Visit(descriptor.AssertNotNull());
            verify?.Invoke(visitor, descriptor);
        }
        // TODO: TBD: where were we headed with these? apparently somewhere else why were they private?
        private static void VerifyVisitorThrows <TException>(VisitorVerificationAction verifyVisitor
                                                             , ProtoDescriptor descriptor, Action <TException> verifyException = null)
            where TException : Exception
        {
            Action GetVisitorVerificationAction() => () => VerifyVisitor(descriptor, verifyVisitor);

            var exception = GetVisitorVerificationAction().AssertThrows <TException>();

            verifyException?.Invoke(exception);
        }
Example #4
0
        public override void Visit(ProtoDescriptor descriptor)
        {
            Stack.PushBack(() => CompilationUnits);

            base.Visit(descriptor);
        }