当前位置: 首页>>代码示例>>C#>>正文


C# ParametersCompiled.Clone方法代码示例

本文整理汇总了C#中Mono.CSharp.ParametersCompiled.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ParametersCompiled.Clone方法的具体用法?C# ParametersCompiled.Clone怎么用?C# ParametersCompiled.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.CSharp.ParametersCompiled的用法示例。


在下文中一共展示了ParametersCompiled.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: yyparse


//.........这里部分代码省略.........
case 175:
#line 1556 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		lexer.ConstraintsParsing = false;
		valid_param_mod = 0;
		MemberName name = (MemberName) yyVals[-6+yyTop];
		current_local_parameters = (ParametersCompiled) yyVals[-3+yyTop];

		GenericMethod generic = null;
		if (name.TypeArguments != null) {
			generic = new GenericMethod (current_namespace, current_class, name,
						     (FullNamedExpression) yyVals[-7+yyTop], current_local_parameters);

			generic.SetParameterInfo ((List<Constraints>) yyVals[0+yyTop]);
		} else if (yyVals[0+yyTop] != null) {
			report.Error (80, GetLocation (yyVals[0+yyTop]),
				"Constraints are not allowed on non-generic declarations");
		}
		var modifiers = (Modifiers) yyVals[-8+yyTop];
		if((Modifiers.INTERACTION & modifiers) != 0){
		   modifiers = (modifiers ^ Modifiers.INTERACTION) | Modifiers.PUBLIC;
		   isInteraction = true;		   
		} else {
		   isInteraction = false;
		}
		var method = Method.Create (current_class, generic, (FullNamedExpression) yyVals[-7+yyTop], modifiers,
				     name, current_local_parameters, (Attributes) yyVals[-9+yyTop], yyVals[0+yyTop] != null);
		if(current_container.Kind == MemberKind.Interface && current_extensionContainer != null){
		    var parameters = new List<Parameter>();
            var typeExpression = new TypeExpression (compiler.BuiltinTypes.Object, GetLocation (yyVals[-9+yyTop]));
            var parameter = new Parameter(typeExpression, "self", Parameter.Modifier.This, null, GetLocation(yyVals[-9+yyTop]));
            parameters.Add(parameter);
            parameters.Add(new Parameter(typeExpression, "ctx", Parameter.Modifier.NONE, null, GetLocation(yyVals[-9+yyTop])));
		    var clone = current_local_parameters.Clone();
		    for(var i = 0; i < clone.Count; i++){
		       parameters.Add(clone[i]);
		    }
		    
			var parameterTypeExpressions = parameters.Select(p=>p.TypeExpression).ToList();
			var key = current_namespace.NS.Name + "," + name.Name + "," + string.Join(",",parameterTypeExpressions.Select(p => p.ToString()));
			if(roleExtensionMethodDummies.Add(key)){
               var returnType = (FullNamedExpression) yyVals[-7+yyTop];
			   var parametersCompiled = new ParametersCompiled(parameters.ToArray(),false);
		       var dummy = Method.Create (current_extensionContainer, generic, (FullNamedExpression) yyVals[-7+yyTop], Modifiers.PUBLIC | Modifiers.STATIC,
				       name, parametersCompiled, (Attributes) yyVals[-9+yyTop], yyVals[0+yyTop] != null);
                var location = GetLocation(yyVals[-9+yyTop]);
				var parameterName = new SimpleName("self", null, location);
				var getTypeAccess = new MemberAccess(parameterName, "GetType", null, location);
                var getTypeExpression =  new Invocation(getTypeAccess, new Arguments(0));
                var argCount = parameterTypeExpressions.Count-1;
                var argumentsForGetMethod = new Arguments(2);
				var stringLiteral =  new StringLiteral(compiler.BuiltinTypes,name.Name,location);
                argumentsForGetMethod.Add(new Argument(stringLiteral));
				var typeName = new SimpleName("Type", null, location);
				var types = parameterTypeExpressions.Skip(2)
				                          .Select(t =>(Expression)(t.Type != null 
										                             ? new TypeOf(t.Type,location) 
																	 : new TypeOf(t,location))
									  ).ToList();
				var initializer = new ArrayInitializer(types,location);
                var parameterTypes = new ImplicitlyTypedArrayCreation (
				                           new ComposedTypeSpecifier (1, location), 
										   initializer, 
										   location);
		        lbag.AddLocation (parameterTypes, location, location);
				
开发者ID:runefs,项目名称:Marvin,代码行数:66,代码来源:cs-parser.cs


注:本文中的Mono.CSharp.ParametersCompiled.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。