Пример #1
0
        void CompareTypeParameters(ComparisonNode parent, ICompGenericParameter reference, ICompGenericParameter target)
        {
            var r = reference.GetTypeParameters();
            var t = target.GetTypeParameters();

            if (r == null && t == null)
            {
                return;
            }

            if (r.Count != t.Count)
            {
                throw new NotImplementedException(string.Format("Should never happen with valid data ({0} != {1})", r.Count, t.Count));
            }

            for (int i = 0; i < r.Count; ++i)
            {
                var r_i = r [i];
                var t_i = t [i];

                if (r_i.GenericAttributes != t_i.GenericAttributes)
                {
                    HandleError(parent, string.Format("reference type parameter {2} has {0} generic attributes, target type parameter {3} has {1} generic attributes",
                                                      CompGenericParameter.GetGenericAttributeDesc(r_i.GenericAttributes),
                                                      CompGenericParameter.GetGenericAttributeDesc(t_i.GenericAttributes),
                                                      r_i.Name,
                                                      t_i.Name));
                }

                CompareAttributes(parent, r_i, t_i);

                // TODO: Compare contraints
            }
        }
        void CompareTypeParameters(ComparisonNode parent, ICompGenericParameter reference, ICompGenericParameter target)
        {
            var r = reference.GetTypeParameters();
            var t = target.GetTypeParameters();

            if (r == null && t == null || (r == null && t != null) || (r != null && t == null))
            {
                return;
            }

            for (int i = 0; i < r.Count; ++i)
            {
                var r_i = r [i];
                var t_i = t [i];

                if (r_i.GenericAttributes != t_i.GenericAttributes)
                {
                    parent.AddError(string.Format("Expected type parameter {2} with {0} generic attributes but found type parameter {3} with {1} generic attributes",
                                                  CompGenericParameter.GetGenericAttributeDesc(r_i.GenericAttributes),
                                                  CompGenericParameter.GetGenericAttributeDesc(t_i.GenericAttributes),
                                                  r_i.Name,
                                                  t_i.Name));
                }

                // TODO: Compare constraints properly
                if (r_i.HasConstraints != t_i.HasConstraints)
                {
                    parent.AddError(string.Format("Type parameter `{0}' constraints mismatch", r_i.Name));
                }

                CompareAttributes(parent, r_i, t_i);
            }
        }
Пример #3
0
		void CompareTypeParameters (ComparisonNode parent, ICompGenericParameter reference, ICompGenericParameter target)
		{
			var r = reference.GetTypeParameters ();
			var t = target.GetTypeParameters ();
			if (r == null && t == null)
				return;

			if (r.Count != t.Count) {
				throw new NotImplementedException (string.Format ("Should never happen with valid data ({0} != {1})", r.Count, t.Count));
			}

			for (int i = 0; i < r.Count; ++i) {
				var r_i = r [i];
				var t_i = t [i];
				
				if (r_i.GenericAttributes != t_i.GenericAttributes) {
					parent.AddError (string.Format ("reference type parameter {2} has {0} generic attributes, target type parameter {3} has {1} generic attributes",
						CompGenericParameter.GetGenericAttributeDesc (r_i.GenericAttributes),
						CompGenericParameter.GetGenericAttributeDesc (t_i.GenericAttributes),
						r_i.Name,
						t_i.Name));
				}

				// TODO: Compare constraints properly			
				if (r_i.HasConstraints != t_i.HasConstraints) {
					parent.AddError (string.Format ("Type parameter `{0}' constraints mismatch", r_i.Name));
				}

				CompareAttributes (parent, r_i, t_i);
			}
		}
Пример #4
0
		void CompareTypeParameters (ComparisonNode parent, ICompGenericParameter reference, ICompGenericParameter target)
		{
			var r = reference.GetTypeParameters ();
			var t = target.GetTypeParameters ();
			if (r == null && t == null || (r == null && t != null) || (r != null && t == null))
				return;

			for (int i = 0; i < r.Count; ++i) {
				var r_i = r [i];
				var t_i = t [i];
				
				if (r_i.GenericAttributes != t_i.GenericAttributes) {
					parent.AddError (string.Format ("Expected type parameter {2} with {0} generic attributes but found type parameter {3} with {1} generic attributes",
						CompGenericParameter.GetGenericAttributeDesc (r_i.GenericAttributes),
						CompGenericParameter.GetGenericAttributeDesc (t_i.GenericAttributes),
						r_i.Name,
						t_i.Name));
				}

				// TODO: Compare constraints properly			
				if (r_i.HasConstraints != t_i.HasConstraints) {
					parent.AddError (string.Format ("Type parameter `{0}' constraints mismatch", r_i.Name));
				}

				CompareAttributes (parent, r_i, t_i);
			}
		}