本文整理汇总了C#中Mono.CSharp.AParametersCollection类的典型用法代码示例。如果您正苦于以下问题:C# AParametersCollection类的具体用法?C# AParametersCollection怎么用?C# AParametersCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AParametersCollection类属于Mono.CSharp命名空间,在下文中一共展示了AParametersCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateDelegateType
public static TypeSpec CreateDelegateType (ResolveContext rc, AParametersCollection parameters, TypeSpec returnType, Location loc)
{
Namespace type_ns = rc.Module.GlobalRootNamespace.GetNamespace ("System", true);
if (type_ns == null) {
return null;
}
if (returnType == rc.BuiltinTypes.Void) {
var actArgs = parameters.Types;
var actionSpec = type_ns.LookupType (rc.Module, "Action", actArgs.Length, LookupMode.Normal, loc).ResolveAsType(rc);
if (actionSpec == null) {
return null;
}
if (actArgs.Length == 0)
return actionSpec;
else
return actionSpec.MakeGenericType(rc, actArgs);
} else {
TypeSpec[] funcArgs = new TypeSpec[parameters.Types.Length + 1];
parameters.Types.CopyTo(funcArgs, 0);
funcArgs[parameters.Types.Length] = returnType;
var funcSpec = type_ns.LookupType (rc.Module, "Func", funcArgs.Length, LookupMode.Normal, loc).ResolveAsType(rc);
if (funcSpec == null)
return null;
return funcSpec.MakeGenericType(rc, funcArgs);
}
}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:26,代码来源:delegate.cs
示例2: CreateDelegateType
public static TypeSpec CreateDelegateType (ResolveContext rc, AParametersCollection parameters, TypeSpec returnType, Location loc)
{
Namespace type_ns;
string paramsSuffix = "";
TypeSpec[] paramTypes = parameters.Types;
type_ns = rc.Module.GlobalRootNamespace.GetNamespace ("System", true);
// Do we have a PARAMS argument as the final argument? (Only supported in PlayScript)
if (rc.FileType == SourceFileType.PlayScript && parameters.FixedParameters.Length > 0 &&
(parameters.FixedParameters [parameters.FixedParameters.Length - 1].ModFlags & Parameter.Modifier.PARAMS) != 0) {
paramsSuffix = "P";
TypeSpec[] newTypes = new TypeSpec[paramTypes.Length - 1];
Array.Copy (paramTypes, 0, newTypes, 0, newTypes.Length);
paramTypes = newTypes;
type_ns = rc.Module.GlobalRootNamespace.GetNamespace ("PlayScript", true);
}
if (type_ns == null) {
return null;
}
if (returnType == rc.BuiltinTypes.Void) {
var actArgs = paramTypes;
var actionType = type_ns.LookupType (rc.Module, "Action" + paramsSuffix, actArgs.Length, LookupMode.Normal, loc);
if (actionType == null) {
return rc.BuiltinTypes.Delegate;
}
var actionSpec = actionType.ResolveAsType(rc);
if (actionSpec == null) {
return null;
}
if (actArgs.Length == 0)
return actionSpec;
else
return actionSpec.MakeGenericType(rc, actArgs);
} else {
TypeSpec[] funcArgs = new TypeSpec[paramTypes.Length + 1];
paramTypes.CopyTo(funcArgs, 0);
funcArgs[paramTypes.Length] = returnType;
var funcSpec = type_ns.LookupType (rc.Module, "Func" + paramsSuffix, funcArgs.Length, LookupMode.Normal, loc).ResolveAsType(rc);
if (funcSpec == null) {
return rc.BuiltinTypes.Delegate;
}
return funcSpec.MakeGenericType(rc, funcArgs);
}
}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:46,代码来源:delegate.cs
示例3: GetApplicableParametersCount
protected override int GetApplicableParametersCount (MethodBase method, AParametersCollection parameters)
{
//
// Here is the trick, decrease number of arguments by 1 when only
// available property method is setter. This makes overload resolution
// work correctly for indexers.
//
if (method.Name [0] == 'g')
return parameters.Count;
return parameters.Count - 1;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:13,代码来源:expression.cs
示例4: VerifyExplicitParameters
protected bool VerifyExplicitParameters (ResolveContext ec, TypeSpec delegate_type, AParametersCollection parameters)
{
if (VerifyParameterCompatibility (ec, delegate_type, parameters, ec.IsInProbingMode))
return true;
if (!ec.IsInProbingMode)
ec.Report.Error (1661, loc,
"Cannot convert `{0}' to delegate type `{1}' since there is a parameter mismatch",
GetSignatureForError (), TypeManager.CSharpName (delegate_type));
return false;
}
开发者ID:rabink,项目名称:mono,代码行数:12,代码来源:anonymous.cs
示例5: IndexerSpec
public IndexerSpec (TypeSpec declaringType, IMemberDefinition definition, TypeSpec memberType, AParametersCollection parameters, PropertyInfo info, Modifiers modifiers)
: base (MemberKind.Indexer, declaringType, definition, memberType, info, modifiers)
{
this.parameters = parameters;
}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:5,代码来源:property.cs
示例6: AddParameter
public void AddParameter (MonoDevelop.Projects.Dom.AbstractMember member, AParametersCollection parameters)
{
for (int i = 0; i < parameters.Count; i++) {
var p = (Parameter)parameters.FixedParameters[i];
DomParameter parameter = new DomParameter ();
parameter.Name = ConvertQuoted (p.Name);
parameter.Location = Convert (p.Location);
parameter.ReturnType = ConvertReturnType (p.TypeExpression);
var modifiers = MonoDevelop.Projects.Dom.ParameterModifiers.None;
if ((p.ParameterModifier & Parameter.Modifier.OUT) == Parameter.Modifier.OUT)
modifiers |= MonoDevelop.Projects.Dom.ParameterModifiers.Out;
if ((p.ParameterModifier & Parameter.Modifier.REF) == Parameter.Modifier.REF)
modifiers |= MonoDevelop.Projects.Dom.ParameterModifiers.Ref;
if ((p.ParameterModifier & Parameter.Modifier.PARAMS) == Parameter.Modifier.PARAMS)
modifiers |= MonoDevelop.Projects.Dom.ParameterModifiers.Params;
if ((p.ParameterModifier & Parameter.Modifier.This) == Parameter.Modifier.This)
modifiers |= MonoDevelop.Projects.Dom.ParameterModifiers.This;
parameter.ParameterModifiers = modifiers;
member.Add (parameter);
}
}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:21,代码来源:McsParser.cs
示例7: ImportedGenericMethodDefinition
public ImportedGenericMethodDefinition (MethodInfo provider, TypeSpec type, AParametersCollection parameters, TypeParameterSpec[] tparams, MetadataImporter importer)
: base (provider, type, parameters, importer)
{
this.tparams = tparams;
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:5,代码来源:import.cs
示例8: VerifyParameterCompatibility
protected bool VerifyParameterCompatibility (ResolveContext ec, TypeInferenceContext tic, TypeSpec delegate_type, AParametersCollection invoke_pd, bool ignore_errors)
{
if (Parameters.Count != invoke_pd.Count) {
if (ignore_errors)
return false;
ec.Report.Error (1593, loc, "Delegate `{0}' does not take `{1}' arguments",
delegate_type.GetSignatureForError (), Parameters.Count.ToString ());
return false;
}
bool has_implicit_parameters = !HasExplicitParameters;
bool error = false;
for (int i = 0; i < Parameters.Count; ++i) {
Parameter.Modifier p_mod = invoke_pd.FixedParameters [i].ModFlags;
if (Parameters.FixedParameters [i].ModFlags != p_mod && p_mod != Parameter.Modifier.PARAMS) {
if (ignore_errors)
return false;
if (p_mod == Parameter.Modifier.NONE)
ec.Report.Error (1677, Parameters[i].Location, "Parameter `{0}' should not be declared with the `{1}' keyword",
(i + 1).ToString (), Parameter.GetModifierSignature (Parameters [i].ModFlags));
else
ec.Report.Error (1676, Parameters[i].Location, "Parameter `{0}' must be declared with the `{1}' keyword",
(i+1).ToString (), Parameter.GetModifierSignature (p_mod));
error = true;
}
if (has_implicit_parameters)
continue;
TypeSpec type = invoke_pd.Types [i];
if (tic != null)
type = tic.InflateGenericArgument (ec, type);
if (!TypeSpecComparer.IsEqual (type, Parameters.Types [i])) {
if (ignore_errors)
return false;
ec.Report.Error (1678, Parameters [i].Location, "Parameter `{0}' is declared as type `{1}' but should be `{2}'",
(i+1).ToString (),
Parameters.Types [i].GetSignatureForError (),
invoke_pd.Types [i].GetSignatureForError ());
error = true;
}
}
return !error;
}
开发者ID:erik-kallen,项目名称:NRefactory,代码行数:51,代码来源:anonymous.cs
示例9: ImportedGenericMethodDefinition
public ImportedGenericMethodDefinition (MethodInfo provider, AParametersCollection parameters, TypeParameterSpec[] tparams)
: base (provider, parameters)
{
this.tparams = tparams;
}
开发者ID:telurmasin,项目名称:mono,代码行数:5,代码来源:import.cs
示例10: AreOverloadedMethodParamsClsCompliant
/// <summary>
/// Returns true if parameters of two compared methods are CLS-Compliant.
/// It tests differing only in ref or out, or in array rank.
/// </summary>
public static Result AreOverloadedMethodParamsClsCompliant (AParametersCollection pa, AParametersCollection pb)
{
TypeSpec [] types_a = pa.Types;
TypeSpec [] types_b = pb.Types;
if (types_a == null || types_b == null)
return Result.Ok;
if (types_a.Length != types_b.Length)
return Result.Ok;
Result result = Result.Ok;
for (int i = 0; i < types_b.Length; ++i) {
TypeSpec aType = types_a [i];
TypeSpec bType = types_b [i];
var ac_a = aType as ArrayContainer;
var ac_b = aType as ArrayContainer;
if (ac_a != null && ac_b != null) {
if (ac_a.Rank != ac_b.Rank && ac_a.Element == ac_b.Element) {
result = Result.RefOutArrayError;
continue;
}
if (ac_a.Element.IsArray || ac_b.Element.IsArray) {
result = Result.ArrayArrayError;
continue;
}
}
if (aType != bType)
return Result.Ok;
const Parameter.Modifier out_ref_mod = (Parameter.Modifier.OUTMASK | Parameter.Modifier.REFMASK);
if ((pa.FixedParameters[i].ModFlags & out_ref_mod) != (pb.FixedParameters[i].ModFlags & out_ref_mod))
result = Result.RefOutArrayError;
}
return result;
}
开发者ID:alisci01,项目名称:mono,代码行数:43,代码来源:attribute.cs
示例11: ParametersImported
ParametersImported (AParametersCollection param, TypeSpec[] types)
{
this.parameters = param.FixedParameters;
this.types = types;
has_arglist = param.HasArglist;
has_params = param.HasParams;
}
开发者ID:afaerber,项目名称:mono,代码行数:7,代码来源:parameter.cs
示例12: GetApplicableParametersCount
protected virtual int GetApplicableParametersCount(MethodSpec method, AParametersCollection parameters)
{
return parameters.Count;
}
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:ecore.cs
示例13: Error_InvalidArguments
protected virtual void Error_InvalidArguments(ResolveContext ec, Location loc, int idx, MethodSpec method,
Argument a, AParametersCollection expected_par, TypeSpec paramType)
{
ExtensionMethodGroupExpr emg = this as ExtensionMethodGroupExpr;
if (a is CollectionElementInitializer.ElementInitializerArgument) {
ec.Report.SymbolRelatedToPreviousError (method);
if ((expected_par.FixedParameters [idx].ModFlags & Parameter.Modifier.ISBYREF) != 0) {
ec.Report.Error (1954, loc, "The best overloaded collection initalizer method `{0}' cannot have 'ref', or `out' modifier",
TypeManager.CSharpSignature (method));
return;
}
ec.Report.Error (1950, loc, "The best overloaded collection initalizer method `{0}' has some invalid arguments",
TypeManager.CSharpSignature (method));
} else if (TypeManager.IsDelegateType (method.DeclaringType)) {
ec.Report.Error (1594, loc, "Delegate `{0}' has some invalid arguments",
TypeManager.CSharpName (method.DeclaringType));
} else {
ec.Report.SymbolRelatedToPreviousError (method);
if (emg != null) {
ec.Report.Error (1928, loc,
"Type `{0}' does not contain a member `{1}' and the best extension method overload `{2}' has some invalid arguments",
emg.ExtensionExpression.GetSignatureForError (),
emg.Name, TypeManager.CSharpSignature (method));
} else {
ec.Report.Error (1502, loc, "The best overloaded method match for `{0}' has some invalid arguments",
TypeManager.CSharpSignature (method));
}
}
Parameter.Modifier mod = idx >= expected_par.Count ? 0 : expected_par.FixedParameters [idx].ModFlags;
string index = (idx + 1).ToString ();
if (((mod & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) ^
(a.Modifier & (Parameter.Modifier.REF | Parameter.Modifier.OUT))) != 0) {
if ((mod & Parameter.Modifier.ISBYREF) == 0)
ec.Report.Error (1615, loc, "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' modifier",
index, Parameter.GetModifierSignature (a.Modifier));
else
ec.Report.Error (1620, loc, "Argument `#{0}' is missing `{1}' modifier",
index, Parameter.GetModifierSignature (mod));
} else {
string p1 = a.GetSignatureForError ();
string p2 = TypeManager.CSharpName (paramType);
if (p1 == p2) {
ec.Report.ExtraInformation (loc, "(equally named types possibly from different assemblies in previous ");
ec.Report.SymbolRelatedToPreviousError (a.Expr.Type);
ec.Report.SymbolRelatedToPreviousError (paramType);
}
if (idx == 0 && emg != null) {
ec.Report.Error (1929, loc,
"Extension method instance type `{0}' cannot be converted to `{1}'", p1, p2);
} else {
ec.Report.Error (1503, loc,
"Argument `#{0}' cannot convert `{1}' expression to type `{2}'", index, p1, p2);
}
}
}
开发者ID:speier,项目名称:shake,代码行数:60,代码来源:ecore.cs
示例14: Create
//
// Generic method parameters importer, param is shared between all instances
//
public static AParametersCollection Create (AParametersCollection param, MethodBase method)
{
if (param.IsEmpty)
return param;
ParameterInfo [] pi = method.GetParameters ();
Type [] types = new Type [pi.Length];
for (int i = 0; i < types.Length; i++) {
Type t = pi [i].ParameterType;
if (t.IsByRef)
t = TypeManager.GetElementType (t);
types [i] = TypeManager.TypeToCoreType (t);
}
return new ParametersCollection (param, types);
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:20,代码来源:parameter.cs
示例15: AreOverloadedMethodParamsClsCompliant
/// <summary>
/// Returns true if parameters of two compared methods are CLS-Compliant.
/// It tests differing only in ref or out, or in array rank.
/// </summary>
public static Result AreOverloadedMethodParamsClsCompliant (AParametersCollection pa, AParametersCollection pb)
{
Type [] types_a = pa.Types;
Type [] types_b = pb.Types;
if (types_a == null || types_b == null)
return Result.Ok;
if (types_a.Length != types_b.Length)
return Result.Ok;
Result result = Result.Ok;
for (int i = 0; i < types_b.Length; ++i) {
Type aType = types_a [i];
Type bType = types_b [i];
if (aType.IsArray && bType.IsArray) {
Type a_el_type = TypeManager.GetElementType (aType);
Type b_el_type = TypeManager.GetElementType (bType);
if (aType.GetArrayRank () != bType.GetArrayRank () && a_el_type == b_el_type) {
result = Result.RefOutArrayError;
continue;
}
if (a_el_type.IsArray || b_el_type.IsArray) {
result = Result.ArrayArrayError;
continue;
}
}
if (aType != bType)
return Result.Ok;
const Parameter.Modifier out_ref_mod = (Parameter.Modifier.OUTMASK | Parameter.Modifier.REFMASK);
if ((pa.FixedParameters[i].ModFlags & out_ref_mod) != (pb.FixedParameters[i].ModFlags & out_ref_mod))
result = Result.RefOutArrayError;
}
return result;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:42,代码来源:attribute.cs
示例16: ImportedMethodDefinition
public ImportedMethodDefinition (MethodBase provider, AParametersCollection parameters)
: base (provider)
{
this.parameters = parameters;
}
开发者ID:telurmasin,项目名称:mono,代码行数:5,代码来源:import.cs
示例17: ImportedIndexerDefinition
public ImportedIndexerDefinition (PropertyInfo provider, AParametersCollection parameters)
: base (provider)
{
this.parameters = parameters;
}
开发者ID:telurmasin,项目名称:mono,代码行数:5,代码来源:import.cs
示例18: CreateDelegateMethodArguments
public static Arguments CreateDelegateMethodArguments (AParametersCollection pd, TypeSpec[] types, Location loc)
{
Arguments delegate_arguments = new Arguments (pd.Count);
for (int i = 0; i < pd.Count; ++i) {
Argument.AType atype_modifier;
switch (pd.FixedParameters [i].ModFlags) {
case Parameter.Modifier.REF:
atype_modifier = Argument.AType.Ref;
break;
case Parameter.Modifier.OUT:
atype_modifier = Argument.AType.Out;
break;
default:
atype_modifier = 0;
break;
}
delegate_arguments.Add (new Argument (new TypeExpression (types [i], loc), atype_modifier));
}
return delegate_arguments;
}
开发者ID:silk,项目名称:monodevelop,代码行数:22,代码来源:delegate.cs
示例19: CreateDelegateMethodArguments
public static Arguments CreateDelegateMethodArguments (ResolveContext rc, AParametersCollection pd, TypeSpec[] types, Location loc)
{
Arguments delegate_arguments = new Arguments (pd.Count);
for (int i = 0; i < pd.Count; ++i) {
Argument.AType atype_modifier;
switch (pd.FixedParameters [i].ModFlags & Parameter.Modifier.RefOutMask) {
case Parameter.Modifier.REF:
atype_modifier = Argument.AType.Ref;
break;
case Parameter.Modifier.OUT:
atype_modifier = Argument.AType.Out;
break;
default:
atype_modifier = 0;
break;
}
var ptype = types[i];
if (ptype.BuiltinType == BuiltinTypeSpec.Type.Dynamic)
ptype = rc.BuiltinTypes.Object;
delegate_arguments.Add (new Argument (new TypeExpression (ptype, loc), atype_modifier));
}
return delegate_arguments;
}
开发者ID:psni,项目名称:mono,代码行数:26,代码来源:delegate.cs
示例20: FindDocumentedMember
//
// Returns a MemberInfo that is referenced in XML documentation
// (by "see" or "seealso" elements).
//
private static MemberSpec FindDocumentedMember(MemberCore mc,
TypeSpec type, string member_name, AParametersCollection param_list,
DeclSpace ds, out int warning_type, string cref,
bool warn419, string name_for_error, Report r)
{
// for (; type != null; type = type.DeclaringType) {
var mi = FindDocumentedMemberNoNest (
mc, type, member_name, param_list, ds,
out warning_type, cref, warn419,
name_for_error, r);
if (mi != null)
return mi; // new FoundMember (type, mi);
// }
warning_type = 0;
return null;
}
开发者ID:speier,项目名称:shake,代码行数:20,代码来源:doc.cs
注:本文中的Mono.CSharp.AParametersCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论