ICSharpCode.NRefactory.MonoCSharp.Method.CreateTypeParameters C# (CSharp) Method

CreateTypeParameters() private method

private CreateTypeParameters ( ) : void
return void
		void CreateTypeParameters ()
		{
			var tparams = MemberName.TypeParameters;
			var parent_tparams = Parent.TypeParametersAll;

			for (int i = 0; i < MemberName.Arity; i++) {
				string type_argument_name = tparams[i].MemberName.Name;

				if (block == null) {
					int idx = parameters.GetParameterIndexByName (type_argument_name);
					if (idx >= 0) {
						var b = block;
						if (b == null)
							b = new ToplevelBlock (Compiler, Location);

						b.Error_AlreadyDeclaredTypeParameter (type_argument_name, parameters[i].Location);
					}
				} else {
					INamedBlockVariable variable = null;
					block.GetLocalName (type_argument_name, block, ref variable);
					if (variable != null)
						variable.Block.Error_AlreadyDeclaredTypeParameter (type_argument_name, variable.Location);
				}

				if (parent_tparams != null) {
					var tp = parent_tparams.Find (type_argument_name);
					if (tp != null) {
						tparams[i].WarningParentNameConflict (tp);
					}
				}
			}

			tparams.Create (null, 0, Parent);
		}