+2009-01-29 Marek Safar <marek.safar@gmail.com>
+
+ *.cs: Rename Parameters to ParametersCompiled and ParametersImported
+ when I finally found the right naming convention.
+
2009-01-29 Marek Safar <marek.safar@gmail.com>
* cs-tokenizer.cs: Put back different open parens optimization.
public virtual bool HasExplicitParameters {
get {
- return Parameters != Parameters.Undefined;
+ return Parameters != ParametersCompiled.Undefined;
}
}
- public Parameters Parameters {
+ public ParametersCompiled Parameters {
get { return Block.Parameters; }
}
return null;
}
- protected virtual Parameters ResolveParameters (EmitContext ec, TypeInferenceContext tic, Type delegate_type)
+ protected virtual ParametersCompiled ResolveParameters (EmitContext ec, TypeInferenceContext tic, Type delegate_type)
{
AParametersCollection delegate_parameters = TypeManager.GetDelegateParameters (delegate_type);
- if (Parameters == Parameters.Undefined) {
+ if (Parameters == ParametersCompiled.Undefined) {
//
// We provide a set of inaccessible parameters
//
delegate_parameters.FixedParameters [i].ModFlags, null, loc);
}
- return Parameters.CreateFullyResolved (fixedpars, delegate_parameters.Types);
+ return ParametersCompiled.CreateFullyResolved (fixedpars, delegate_parameters.Types);
}
if (!VerifyExplicitParameters (delegate_type, delegate_parameters, ec.IsInProbingMode)) {
protected AnonymousMethodBody CompatibleMethod (EmitContext ec, TypeInferenceContext tic, Type return_type, Type delegate_type)
{
- Parameters p = ResolveParameters (ec, tic, delegate_type);
+ ParametersCompiled p = ResolveParameters (ec, tic, delegate_type);
if (p == null)
return null;
return anonymous;
}
- protected virtual AnonymousMethodBody CompatibleMethodFactory (Type return_type, Type delegate_type, Parameters p, ToplevelBlock b)
+ protected virtual AnonymousMethodBody CompatibleMethodFactory (Type return_type, Type delegate_type, ParametersCompiled p, ToplevelBlock b)
{
return new AnonymousMethodBody (p, b, return_type, delegate_type, loc);
}
public AnonymousMethodMethod (DeclSpace parent, AnonymousExpression am, AnonymousMethodStorey storey,
GenericMethod generic, TypeExpr return_type,
int mod, string real_name, MemberName name,
- Parameters parameters)
+ ParametersCompiled parameters)
: base (parent, generic, return_type, mod | Modifiers.COMPILER_GENERATED,
name, parameters, null)
{
public class AnonymousMethodBody : AnonymousExpression
{
- protected readonly Parameters parameters;
+ protected readonly ParametersCompiled parameters;
AnonymousMethodStorey storey;
AnonymousMethodMethod method;
static int unique_id;
- public AnonymousMethodBody (Parameters parameters,
+ public AnonymousMethodBody (ParametersCompiled parameters,
ToplevelBlock block, Type return_type, Type delegate_type,
Location loc)
: base (block, return_type, loc)
//
public class AnonymousTypeClass : CompilerGeneratedClass
{
- sealed class AnonymousParameters : Parameters
+ sealed class AnonymousParameters : ParametersCompiled
{
public AnonymousParameters (params Parameter[] parameters)
: base (parameters)
Method equals = new Method (this, null, TypeManager.system_boolean_expr,
Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN, new MemberName ("Equals", loc),
- Mono.CSharp.Parameters.CreateFullyResolved (new Parameter (null, "obj", 0, null, loc), TypeManager.object_type), null);
+ Mono.CSharp.ParametersCompiled.CreateFullyResolved (new Parameter (null, "obj", 0, null, loc), TypeManager.object_type), null);
Method tostring = new Method (this, null, TypeManager.system_string_expr,
Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN, new MemberName ("ToString", loc),
- Mono.CSharp.Parameters.EmptyReadOnlyParameters, null);
+ Mono.CSharp.ParametersCompiled.EmptyReadOnlyParameters, null);
ToplevelBlock equals_block = new ToplevelBlock (equals.Parameters, loc);
TypeExpr current_type;
Method hashcode = new Method (this, null, TypeManager.system_int32_expr,
Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN,
new MemberName ("GetHashCode", loc),
- Mono.CSharp.Parameters.EmptyReadOnlyParameters, null);
+ Mono.CSharp.ParametersCompiled.EmptyReadOnlyParameters, null);
//
// Modified FNV with good avalanche behavior and uniform
}
Constructor c = new Constructor (this, MemberName.Name, mods,
- null, Parameters.EmptyReadOnlyParameters,
+ null, ParametersCompiled.EmptyReadOnlyParameters,
new GeneratedBaseInitializer (Location),
Location);
AddConstructor (c);
- c.Block = new ToplevelBlock (Parameters.EmptyReadOnlyParameters, Location);
+ c.Block = new ToplevelBlock (ParametersCompiled.EmptyReadOnlyParameters, Location);
}
public override bool Define ()
public abstract class MethodCore : InterfaceMemberBase
{
- public readonly Parameters Parameters;
+ public readonly ParametersCompiled Parameters;
protected ToplevelBlock block;
public MethodCore (DeclSpace parent, GenericMethod generic,
FullNamedExpression type, int mod, int allowed_mod,
- MemberName name, Attributes attrs, Parameters parameters)
+ MemberName name, Attributes attrs, ParametersCompiled parameters)
: base (parent, generic, type, mod, allowed_mod, name, attrs)
{
Parameters = parameters;
}
}
- public Parameters ParameterInfo
- {
+ public ParametersCompiled ParameterInfo {
get {
return Parameters;
}
protected virtual bool CheckForDuplications ()
{
return Parent.MemberCache.CheckExistingMembersOverloads (
- this, GetFullName (MemberName), Parameters.EmptyReadOnlyParameters);
+ this, GetFullName (MemberName), ParametersCompiled.EmptyReadOnlyParameters);
}
//
return base.Define ();
}
- protected bool DefineParameters (Parameters parameters)
+ protected bool DefineParameters (ParametersCompiled parameters)
{
IResolveContext rc = GenericMethod == null ? this : (IResolveContext)ds;
protected MethodOrOperator (DeclSpace parent, GenericMethod generic, FullNamedExpression type, int mod,
int allowed_mod, MemberName name,
- Attributes attrs, Parameters parameters)
+ Attributes attrs, ParametersCompiled parameters)
: base (parent, generic, type, mod, allowed_mod, name,
attrs, parameters)
{
public Method (DeclSpace parent, GenericMethod generic,
FullNamedExpression return_type, int mod,
- MemberName name, Parameters parameters, Attributes attrs)
+ MemberName name, ParametersCompiled parameters, Attributes attrs)
: base (parent, generic, return_type, mod,
parent.PartialContainer.Kind == Kind.Interface ? AllowedInterfaceModifiers : AllowedModifiers,
name, attrs, parameters)
}
protected Method (DeclSpace parent, FullNamedExpression return_type, int mod, int amod,
- MemberName name, Parameters parameters, Attributes attrs)
+ MemberName name, ParametersCompiled parameters, Attributes attrs)
: base (parent, null, return_type, mod, amod, name, attrs, parameters)
{
}
Report.Warning (402, 4, Location, "`{0}': an entry point cannot be generic or in a generic type",
GetSignatureForError ());
} else {
- IMethodData md = TypeManager.GetMethod (MethodBuilder);
- md.SetMemberIsUsed ();
-
+ SetMemberIsUsed ();
RootContext.EntryPoint = this;
}
} else {
if (!base.VerifyClsCompliance ())
return false;
- if (ParameterInfo.Count > 0) {
+ if (!Parameters.IsEmpty) {
ArrayList al = (ArrayList)Parent.PartialContainer.MemberCache.Members [Name];
if (al.Count > 1)
MemberCache.VerifyClsParameterConflict (al, this, MethodBuilder);
// The spec claims that static is not permitted, but
// my very own code has static constructors.
//
- public Constructor (DeclSpace parent, string name, int mod, Attributes attrs, Parameters args,
+ public Constructor (DeclSpace parent, string name, int mod, Attributes attrs, ParametersCompiled args,
ConstructorInitializer init, Location loc)
: base (parent, null, null, mod, AllowedModifiers,
new MemberName (name, loc), attrs, args)
((ModFlags & Modifiers.STATIC) == 0) && (Initializer == null))
block.AddThisVariable (Parent, Location);
- if (!block.ResolveMeta (ec, ParameterInfo))
+ if (!block.ResolveMeta (ec, Parameters))
block = null;
if (block != null && (ModFlags & Modifiers.STATIC) == 0){
bool unreachable = false;
if (block != null) {
- if (!ec.ResolveTopBlock (null, block, ParameterInfo, this, out unreachable))
+ if (!ec.ResolveTopBlock (null, block, Parameters, this, out unreachable))
return;
ec.EmitMeta (block);
return false;
}
- if (ParameterInfo.Count > 0) {
- ArrayList al = (ArrayList)Parent.MemberCache.Members [".ctor"];
+ if (!Parameters.IsEmpty) {
+ ArrayList al = (ArrayList)Parent.MemberCache.Members [ConstructorInfo.ConstructorName];
if (al.Count > 2)
MemberCache.VerifyClsParameterConflict (al, this, ConstructorBuilder);
MemberName MethodName { get; }
Type ReturnType { get; }
GenericMethod GenericMethod { get; }
- Parameters ParameterInfo { get; }
+ ParametersCompiled ParameterInfo { get; }
Attributes OptAttributes { get; }
ToplevelBlock Block { get; set; }
/// <summary>
/// Create the MethodBuilder for the method
/// </summary>
- void DefineMethodBuilder (TypeContainer container, string method_name, Parameters param)
+ void DefineMethodBuilder (TypeContainer container, string method_name, ParametersCompiled param)
{
if (builder == null) {
builder = container.TypeBuilder.DefineMethod (
public static readonly string MetadataName = "Finalize";
- public Destructor (DeclSpace parent, int mod, Parameters parameters, Attributes attrs, Location l)
+ public Destructor (DeclSpace parent, int mod, ParametersCompiled parameters, Attributes attrs, Location l)
: base (parent, null, TypeManager.system_void_expr, mod, AllowedModifiers,
new MemberName (MetadataName, l), attrs, parameters)
{
public Attributes Attributes;
public Location Location;
public int ModFlags;
- public Parameters Parameters;
+ public ParametersCompiled Parameters;
- public Accessor (ToplevelBlock b, int mod, Attributes attrs, Parameters p, Location loc)
+ public Accessor (ToplevelBlock b, int mod, Attributes attrs, ParametersCompiled p, Location loc)
{
Block = b;
Attributes = attrs;
}
}
- public abstract Parameters ParameterInfo { get ; }
+ public abstract ParametersCompiled ParameterInfo { get ; }
public abstract Type ReturnType { get; }
public abstract EmitContext CreateEmitContext (DeclSpace ds, ILGenerator ig);
}
}
- public override Parameters ParameterInfo {
+ public override ParametersCompiled ParameterInfo {
get {
- return Parameters.EmptyReadOnlyParameters;
+ return ParametersCompiled.EmptyReadOnlyParameters;
}
}
static string[] attribute_targets = new string [] { "method", "param", "return" };
ImplicitParameter param_attr;
- protected Parameters parameters;
+ protected ParametersCompiled parameters;
public SetMethod (PropertyBase method) :
base (method, "set_")
{
- parameters = new Parameters (
+ parameters = new ParametersCompiled (
new Parameter (method.type_name, "value", Parameter.Modifier.NONE, null, Location));
}
base.ApplyAttributeBuilder (a, cb);
}
- public override Parameters ParameterInfo {
+ public override ParametersCompiled ParameterInfo {
get {
return parameters;
}
Parent.PartialContainer.AddField (field);
// Create get block
- Get.Block = new ToplevelBlock (Parameters.EmptyReadOnlyParameters, Location);
+ Get.Block = new ToplevelBlock (ParametersCompiled.EmptyReadOnlyParameters, Location);
Return r = new Return (new SimpleName (field.Name, Location), Location);
Get.Block.AddStatement (r);
protected override PropertyInfo ResolveBaseProperty ()
{
return Parent.PartialContainer.BaseCache.FindMemberToOverride (
- Parent.TypeBuilder, Name, Parameters.EmptyReadOnlyParameters, null, true) as PropertyInfo;
+ Parent.TypeBuilder, Name, ParametersCompiled.EmptyReadOnlyParameters, null, true) as PropertyInfo;
}
}
}
}
- public override Parameters ParameterInfo {
+ public override ParametersCompiled ParameterInfo {
get {
return method.parameters;
}
public MyEventBuilder EventBuilder;
public MethodBuilder AddBuilder, RemoveBuilder;
- Parameters parameters;
+ ParametersCompiled parameters;
protected Event (DeclSpace parent, FullNamedExpression type, int mod_flags, MemberName name, Attributes attrs)
: base (parent, null, type, mod_flags,
Report.Error (66, Location, "`{0}': event must be of a delegate type", GetSignatureForError ());
}
- parameters = Parameters.CreateFullyResolved (
+ parameters = ParametersCompiled.CreateFullyResolved (
new Parameter (null, "value", Parameter.Modifier.NONE, null, Location), MemberType);
if (!CheckBase ())
{
public class GetIndexerMethod : GetMethod
{
- Parameters parameters;
+ ParametersCompiled parameters;
public GetIndexerMethod (Indexer method):
base (method)
return false;
}
- public override Parameters ParameterInfo {
+ public override ParametersCompiled ParameterInfo {
get {
return parameters;
}
public SetIndexerMethod (Indexer method):
base (method)
{
- parameters = Parameters.MergeGenerated (method.parameters, false, parameters [0], null);
+ parameters = ParametersCompiled.MergeGenerated (method.parameters, false, parameters [0], null);
}
public SetIndexerMethod (PropertyBase method, Accessor accessor):
const int AllowedInterfaceModifiers =
Modifiers.NEW;
- public readonly Parameters parameters;
+ public readonly ParametersCompiled parameters;
public Indexer (DeclSpace parent, FullNamedExpression type, MemberName name, int mod,
- Parameters parameters, Attributes attrs,
+ ParametersCompiled parameters, Attributes attrs,
Accessor get_block, Accessor set_block, bool define_set_first)
: base (parent, type, mod,
parent.PartialContainer.Kind == Kind.Interface ? AllowedInterfaceModifiers : AllowedModifiers,
}
public Operator (DeclSpace parent, OpType type, FullNamedExpression ret_type,
- int mod_flags, Parameters parameters,
+ int mod_flags, ParametersCompiled parameters,
ToplevelBlock block, Attributes attrs, Location loc)
: base (parent, null, ret_type, mod_flags, AllowedModifiers,
new MemberName (GetMetadataName (type), loc), attrs, parameters)
bool unreachable;
public bool ResolveTopBlock (EmitContext anonymous_method_host, ToplevelBlock block,
- Parameters ip, IMethodData md, out bool unreachable)
+ ParametersCompiled ip, IMethodData md, out bool unreachable)
{
if (resolved) {
unreachable = this.unreachable;
// FIXME: This is very ugly and it's very hard to reset it correctly
// on all places, especially when some parameters are autogenerated.
- Parameters current_local_parameters;
+ ParametersCompiled current_local_parameters;
/// <summary>
/// Using during property parsing to describe the implicit
/// methods (properties and indexers).
/// </summary>
FullNamedExpression implicit_value_parameter_type;
- Parameters indexer_parameters;
+ ParametersCompiled indexer_parameters;
/// <summary>
/// Hack to help create non-typed array initializer
lexer.ConstraintsParsing = false;
arglist_allowed = false;
MemberName name = (MemberName) $4;
- current_local_parameters = (Parameters) $7;
+ current_local_parameters = (ParametersCompiled) $7;
if ($10 != null && name.TypeArguments == null)
Report.Error (80, lexer.Location,
lexer.ConstraintsParsing = false;
MemberName name = (MemberName) $5;
- current_local_parameters = (Parameters) $7;
+ current_local_parameters = (ParametersCompiled) $7;
if ($9 != null && name.TypeArguments == null)
Report.Error (80, lexer.Location,
"Member modifier `{0}' must precede the member type and name", Modifiers.Name ((int) $4));
Method method = new Method (current_class, null, TypeManager.system_void_expr,
- 0, name, (Parameters) $7, (Attributes) $1);
+ 0, name, (ParametersCompiled) $7, (Attributes) $1);
- current_local_parameters = (Parameters) $7;
+ current_local_parameters = (ParametersCompiled) $7;
if (RootContext.Documentation != null)
method.DocComment = Lexer.consume_doc_comment ();
;
opt_formal_parameter_list
- : /* empty */ { $$ = Parameters.EmptyReadOnlyParameters; }
+ : /* empty */ { $$ = ParametersCompiled.EmptyReadOnlyParameters; }
| formal_parameter_list
;
opt_parameter_list_no_mod
- : /* empty */ { $$ = Parameters.EmptyReadOnlyParameters; }
+ : /* empty */ { $$ = ParametersCompiled.EmptyReadOnlyParameters; }
|
{
parameter_modifiers_not_allowed = true;
Parameter [] pars = new Parameter [pars_list.Count];
pars_list.CopyTo (pars);
- $$ = new Parameters (pars);
+ $$ = new ParametersCompiled (pars);
}
| fixed_parameters COMMA parameter_array
{
Parameter [] pars = new Parameter [pars_list.Count];
pars_list.CopyTo (pars);
- $$ = new Parameters (pars);
+ $$ = new ParametersCompiled (pars);
}
| fixed_parameters COMMA arglist_modifier
{
Parameter [] pars = new Parameter [pars_list.Count];
pars_list.CopyTo (pars);
- $$ = new Parameters (pars, true);
+ $$ = new ParametersCompiled (pars, true);
}
| parameter_array COMMA error
{
}
| parameter_array
{
- $$ = new Parameters (new Parameter[] { (Parameter) $1 } );
+ $$ = new ParametersCompiled (new Parameter[] { (Parameter) $1 } );
}
| arglist_modifier
{
- $$ = new Parameters (new Parameter [] { new ArglistParameter ((Location) $1) }, true);
+ $$ = new ParametersCompiled (new Parameter [] { new ArglistParameter ((Location) $1) }, true);
}
;
// If this is not the case, then current_local_parameters has already
// been set in indexer_declaration
if (parsing_indexer == false)
- current_local_parameters = Parameters.EmptyReadOnlyParameters;
+ current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters;
else
current_local_parameters = indexer_parameters;
lexer.PropertyParsing = false;
Parameter.Modifier.NONE, null, (Location) $3);
if (!parsing_indexer) {
- current_local_parameters = new Parameters (new Parameter [] { implicit_value_parameter });
+ current_local_parameters = new ParametersCompiled (new Parameter [] { implicit_value_parameter });
} else {
- current_local_parameters = Parameters.MergeGenerated (
+ current_local_parameters = ParametersCompiled.MergeGenerated (
indexer_parameters, true, implicit_value_parameter, null);
}
Location loc = (Location) $2;
Operator.OpType op = (Operator.OpType) $3;
- current_local_parameters = (Parameters)$6;
+ current_local_parameters = (ParametersCompiled)$6;
int p_count = current_local_parameters.Count;
if (p_count == 1) {
params_modifiers_not_allowed = false;
Location loc = (Location) $2;
- current_local_parameters = (Parameters)$6;
+ current_local_parameters = (ParametersCompiled)$6;
if (RootContext.Documentation != null) {
tmpComment = Lexer.consume_doc_comment ();
params_modifiers_not_allowed = false;
Location loc = (Location) $2;
- current_local_parameters = (Parameters)$6;
+ current_local_parameters = (ParametersCompiled)$6;
if (RootContext.Documentation != null) {
tmpComment = Lexer.consume_doc_comment ();
}
OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
{
- current_local_parameters = (Parameters) $6;
+ current_local_parameters = (ParametersCompiled) $6;
//
// start block here, so possible anonymous methods inside
Lexer.doc_state = XmlCommentState.NotAllowed;
}
- current_local_parameters = Parameters.EmptyReadOnlyParameters;
+ current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters;
}
IDENTIFIER OPEN_PARENS CLOSE_PARENS method_body
{
Report.Error (575, lt.Location, "Only class types can contain destructor");
} else {
Destructor d = new Destructor (current_class, (int) $2,
- Parameters.EmptyReadOnlyParameters, (Attributes) $1, lt.Location);
+ ParametersCompiled.EmptyReadOnlyParameters, (Attributes) $1, lt.Location);
if (RootContext.Documentation != null)
d.DocComment = ConsumeStoredComment ();
OPEN_BRACE
{
implicit_value_parameter_type = (FullNamedExpression) $4;
- current_local_parameters = new Parameters (
+ current_local_parameters = new ParametersCompiled (
new Parameter (implicit_value_parameter_type, "value",
Parameter.Modifier.NONE, null, GetLocation ($3)));
OPEN_BRACE
{
implicit_value_parameter_type = (FullNamedExpression) $3;
- indexer_parameters = (Parameters) $6;
+ indexer_parameters = (ParametersCompiled) $6;
if (indexer_parameters.IsEmpty)
Report.Error (1551, GetLocation ($5), "Indexers must have at least one parameter");
bool order = accessors != null ? accessors.declared_in_reverse : false;
Indexer indexer = new Indexer (current_class, (FullNamedExpression) $3,
- (MemberName)$4, (int) $2, (Parameters) $6, (Attributes) $1,
+ (MemberName)$4, (int) $2, (ParametersCompiled) $6, (Attributes) $1,
get_block, set_block, order);
if ($3 == TypeManager.system_void_expr)
OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
{
MemberName name = MakeName ((MemberName) $5);
- Parameters p = (Parameters) $7;
+ ParametersCompiled p = (ParametersCompiled) $7;
Delegate del = new Delegate (current_namespace, current_class, (FullNamedExpression) $4,
(int) $2, name, p, (Attributes) $1);
anonymous_method_expression
: DELEGATE opt_anonymous_method_signature
{
- start_anonymous (false, (Parameters) $2, (Location) $1);
+ start_anonymous (false, (ParametersCompiled) $2, (Location) $1);
}
block
{
opt_anonymous_method_signature
:
{
- $$ = Parameters.Undefined;
+ $$ = ParametersCompiled.Undefined;
}
| anonymous_method_signature
;
;
opt_lambda_parameter_list
- : /* empty */ { $$ = Parameters.EmptyReadOnlyParameters; }
+ : /* empty */ { $$ = ParametersCompiled.EmptyReadOnlyParameters; }
| lambda_parameter_list {
ArrayList pars_list = (ArrayList) $1;
- $$ = new Parameters ((Parameter[])pars_list.ToArray (typeof (Parameter)));
+ $$ = new ParametersCompiled ((Parameter[])pars_list.ToArray (typeof (Parameter)));
}
;
{
LocatedToken lt = (LocatedToken) $1;
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location);
- start_anonymous (true, new Parameters (p), GetLocation ($1));
+ start_anonymous (true, new ParametersCompiled (p), GetLocation ($1));
}
lambda_expression_body
{
}
| OPEN_PARENS_LAMBDA opt_lambda_parameter_list CLOSE_PARENS ARROW
{
- start_anonymous (true, (Parameters) $2, GetLocation ($1));
+ start_anonymous (true, (ParametersCompiled) $2, GetLocation ($1));
}
lambda_expression_body
{
Parameter [] mpar = new Parameter [1];
mpar [0] = new Parameter (TypeManager.system_object_expr, "$retval", Parameter.Modifier.REF, null, Location.Null);
- Parameters pars = new Parameters (mpar);
+ ParametersCompiled pars = new ParametersCompiled (mpar);
current_local_parameters = pars;
Method method = new Method (
current_class,
}
void
-start_anonymous (bool lambda, Parameters parameters, Location loc)
+start_anonymous (bool lambda, ParametersCompiled parameters, Location loc)
{
if (RootContext.Version == LanguageVersion.ISO_1){
Report.FeatureIsNotAvailable (loc, "anonymous methods");
current_anonymous_method.Block = anon_block;
retval = current_anonymous_method;
- current_local_parameters = (Parameters) oob_stack.Pop ();
+ current_local_parameters = (ParametersCompiled) oob_stack.Pop ();
current_anonymous_method = (AnonymousMethodExpression) oob_stack.Pop ();
return retval;
if (is_property) {
if ((entry.EntryType & EntryType.Field) != 0) {
fi = (FieldInfo)entry.Member;
- cmp_attrs = Parameters.EmptyReadOnlyParameters;
+ cmp_attrs = ParametersCompiled.EmptyReadOnlyParameters;
} else {
pi = (PropertyInfo) entry.Member;
cmp_attrs = TypeManager.GetParameterData (pi);
}
}
- public bool CheckExistingMembersOverloads (MemberCore member, string name, Parameters parameters)
+ public bool CheckExistingMembersOverloads (MemberCore member, string name, ParametersCompiled parameters)
{
ArrayList entries = (ArrayList)member_hash [name];
if (entries == null)
public class Delegate : DeclSpace, IMemberContainer
{
FullNamedExpression ReturnType;
- public Parameters Parameters;
+ public ParametersCompiled Parameters;
public ConstructorBuilder ConstructorBuilder;
public MethodBuilder InvokeBuilder;
Modifiers.PRIVATE;
public Delegate (NamespaceEntry ns, DeclSpace parent, FullNamedExpression type,
- int mod_flags, MemberName name, Parameters param_list,
+ int mod_flags, MemberName name, ParametersCompiled param_list,
Attributes attrs)
: base (ns, parent, name, attrs)
new ParameterData ("method", Parameter.Modifier.NONE)
};
- AParametersCollection const_parameters = new ParametersCollection (
+ AParametersCollection const_parameters = new ParametersImported (
fixed_pars,
new Type[] { TypeManager.object_type, TypeManager.intptr_type });
//
// BeginInvoke
//
- Parameters async_parameters = Parameters.MergeGenerated (Parameters, false,
+ ParametersCompiled async_parameters = ParametersCompiled.MergeGenerated (Parameters, false,
new Parameter [] {
new Parameter (null, "callback", Parameter.Modifier.NONE, null, Location),
new Parameter (null, "object", Parameter.Modifier.NONE, null, Location)
//
// Define parameters, and count out/ref parameters
//
- Parameters end_parameters;
+ ParametersCompiled end_parameters;
int out_params = 0;
foreach (Parameter p in Parameters.FixedParameters) {
end_params [param] = p;
++param;
}
- end_parameters = Parameters.CreateFullyResolved (end_params, end_param_types);
+ end_parameters = ParametersCompiled.CreateFullyResolved (end_params, end_param_types);
} else {
- end_parameters = Parameters.EmptyReadOnlyParameters;
+ end_parameters = ParametersCompiled.EmptyReadOnlyParameters;
}
- end_parameters = Parameters.MergeGenerated (end_parameters, false,
+ end_parameters = ParametersCompiled.MergeGenerated (end_parameters, false,
new Parameter (null, "result", Parameter.Modifier.NONE, null, Location), TypeManager.iasyncresult_type);
//
Parameters.ApplyAttributes (InvokeBuilder);
if (BeginInvokeBuilder != null) {
- Parameters p = (Parameters) TypeManager.GetParameterData (BeginInvokeBuilder);
+ ParametersCompiled p = (ParametersCompiled) TypeManager.GetParameterData (BeginInvokeBuilder);
p.ApplyAttributes (BeginInvokeBuilder);
}
if (g_args != null) {
invoke = TypeBuilder.GetMethod (dt, d.InvokeBuilder);
#if MS_COMPATIBLE
- Parameters p = (Parameters) d.Parameters.InflateTypes (g_args, g_args);
+ ParametersCompiled p = (ParametersCompiled) d.Parameters.InflateTypes (g_args, g_args);
TypeManager.RegisterMethod (invoke, p);
#endif
return invoke;
// Returns a string that represents the signature for this
// member which should be used in XML documentation.
//
- public static string GetMethodDocCommentName (MemberCore mc, Parameters parameters, DeclSpace ds)
+ public static string GetMethodDocCommentName (MemberCore mc, ParametersCompiled parameters, DeclSpace ds)
{
IParameterData [] plist = parameters.FixedParameters;
string paramSpec = String.Empty;
this.IsParameter = false;
}
- public VariableInfo (Parameters ip, int i, int offset)
+ public VariableInfo (ParametersCompiled ip, int i, int offset)
: this (ip.FixedParameters [i].Name, ip.Types [i], offset)
{
this.IsParameter = true;
public class GenericMethod : DeclSpace
{
public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name,
- Expression return_type, Parameters parameters)
+ Expression return_type, ParametersCompiled parameters)
: base (ns, parent, name, null)
{
throw new NotImplementedException ();
public class GenericMethod : DeclSpace
{
FullNamedExpression return_type;
- Parameters parameters;
+ ParametersCompiled parameters;
public GenericMethod (NamespaceEntry ns, DeclSpace parent, MemberName name,
- FullNamedExpression return_type, Parameters parameters)
+ FullNamedExpression return_type, ParametersCompiled parameters)
: base (ns, parent, name, null)
{
this.return_type = return_type;
public IteratorMethod (IteratorStorey host, FullNamedExpression returnType, int mod, MemberName name)
: base (host, null, returnType, mod | Modifiers.DEBUGGER_HIDDEN | Modifiers.COMPILER_GENERATED,
- name, Parameters.EmptyReadOnlyParameters, null)
+ name, ParametersCompiled.EmptyReadOnlyParameters, null)
{
this.host = host;
- Block = new ToplevelBlock (host.Iterator.Container.Toplevel, Parameters.EmptyReadOnlyParameters, Location);
+ Block = new ToplevelBlock (host.Iterator.Container.Toplevel, ParametersCompiled.EmptyReadOnlyParameters, Location);
}
public override EmitContext CreateEmitContext (DeclSpace tc, ILGenerator ig)
{
host.AddMethod (this);
- Block = new ToplevelBlock (host.Iterator.Container, Parameters.EmptyReadOnlyParameters, Location);
+ Block = new ToplevelBlock (host.Iterator.Container, ParametersCompiled.EmptyReadOnlyParameters, Location);
Block.AddStatement (new DisposeMethodStatement (host.Iterator));
}
}
this, null, TypeManager.system_void_expr,
Modifiers.PUBLIC | Modifiers.DEBUGGER_HIDDEN,
new MemberName ("Reset", Location),
- Parameters.EmptyReadOnlyParameters, null);
+ ParametersCompiled.EmptyReadOnlyParameters, null);
AddMethod (reset);
reset.Block = new ToplevelBlock (Location);
//
private Iterator (IMethodData method, TypeContainer host, Type iterator_type, bool is_enumerable)
: base (
- new ToplevelBlock (method.Block, Parameters.EmptyReadOnlyParameters, method.Block.StartLocation),
+ new ToplevelBlock (method.Block, ParametersCompiled.EmptyReadOnlyParameters, method.Block.StartLocation),
TypeManager.bool_type,
method.Location)
{
this, Storey, null, TypeManager.system_boolean_expr,
Modifiers.PUBLIC, OriginalMethod.GetSignatureForError (),
new MemberName ("MoveNext", Location),
- Parameters.EmptyReadOnlyParameters);
+ ParametersCompiled.EmptyReadOnlyParameters);
if (!Compatible (ec))
return null;
return;
}
- Parameters parameters = method.ParameterInfo;
+ ParametersCompiled parameters = method.ParameterInfo;
for (int i = 0; i < parameters.Count; i++) {
Parameter p = parameters [i];
Parameter.Modifier mod = p.ModFlags;
}
}
- protected override Parameters ResolveParameters (EmitContext ec, TypeInferenceContext tic, Type delegateType)
+ protected override ParametersCompiled ResolveParameters (EmitContext ec, TypeInferenceContext tic, Type delegateType)
{
if (!TypeManager.IsDelegateType (delegateType))
return null;
return this;
}
- protected override AnonymousMethodBody CompatibleMethodFactory (Type returnType, Type delegateType, Parameters p, ToplevelBlock b)
+ protected override AnonymousMethodBody CompatibleMethodFactory (Type returnType, Type delegateType, ParametersCompiled p, ToplevelBlock b)
{
return new LambdaMethod (p, b, returnType, delegateType, loc);
}
public class LambdaMethod : AnonymousMethodBody
{
- public LambdaMethod (Parameters parameters,
+ public LambdaMethod (ParametersCompiled parameters,
ToplevelBlock block, Type return_type, Type delegate_type,
Location loc)
: base (parameters, block, return_type, delegate_type, loc)
if (sn == null)
return true;
- return sn.Name != block.Parameters[0].Name;
+ return sn.Name != block.Parameters.FixedParameters [0].Name;
}
}
public static int Counter;
const string ParameterNamePrefix = "<>__TranspIdent";
- public readonly Parameters Parent;
+ public readonly ParametersCompiled Parent;
public readonly string Identifier;
- public TransparentParameter (Parameters parent, LocatedToken identifier)
+ public TransparentParameter (ParametersCompiled parent, LocatedToken identifier)
: base (ParameterNamePrefix + Counter++, identifier.Location)
{
Parent = parent;
}
public QueryBlock (Block parent, LocatedToken lt, Location start)
- : base (parent, new Parameters (new ImplicitQueryParameter (lt.Value, lt.Location)), start)
+ : base (parent, new ParametersCompiled (new ImplicitQueryParameter (lt.Value, lt.Location)), start)
{
if (parent != null)
base.CheckParentConflictName (parent.Toplevel, lt.Value, lt.Location);
}
- public QueryBlock (Block parent, Parameters parameters, LocatedToken lt, Location start)
- : base (parent, new Parameters (parameters [0].Clone (), new ImplicitQueryParameter (lt.Value, lt.Location)), start)
+ public QueryBlock (Block parent, ParametersCompiled parameters, LocatedToken lt, Location start)
+ : base (parent, new ParametersCompiled (parameters [0].Clone (), new ImplicitQueryParameter (lt.Value, lt.Location)), start)
{
}
{
base.CheckParentConflictName (this, name.Value, name.Location);
- parameters = new Parameters (new TransparentParameter (parameters, name));
+ parameters = new ParametersCompiled (new TransparentParameter (parameters, name));
}
protected override bool CheckParentConflictName (ToplevelBlock block, string name, Location l)
}
ParameterAttributes Attributes {
- get { return Parameters.GetParameterAttribute (modFlags); }
+ get { return ParametersCompiled.GetParameterAttribute (modFlags); }
}
public override AttributeTargets AttributeTargets {
//
// A collection of imported or resolved parameters
//
- public class ParametersCollection : AParametersCollection
+ public class ParametersImported : AParametersCollection
{
- ParametersCollection (AParametersCollection param, Type[] types)
+ ParametersImported (AParametersCollection param, Type[] types)
{
this.parameters = param.FixedParameters;
this.types = types;
has_params = param.HasParams;
}
- ParametersCollection (IParameterData [] parameters, Type [] types, MethodBase method, bool hasParams)
+ ParametersImported (IParameterData [] parameters, Type [] types, MethodBase method, bool hasParams)
{
this.parameters = parameters;
this.types = types;
has_params = hasParams;
}
- public ParametersCollection (IParameterData [] param, Type[] types)
+ public ParametersImported (IParameterData [] param, Type[] types)
{
this.parameters = param;
this.types = types;
types [i] = TypeManager.TypeToCoreType (t);
}
- return new ParametersCollection (param, types);
+ return new ParametersImported (param, types);
}
//
{
if (pi.Length == 0) {
if (method != null && (method.CallingConvention & CallingConventions.VarArgs) != 0)
- return new ParametersCollection (new IParameterData [0], Type.EmptyTypes, method, false);
+ return new ParametersImported (new IParameterData [0], Type.EmptyTypes, method, false);
- return Parameters.EmptyReadOnlyParameters;
+ return ParametersCompiled.EmptyReadOnlyParameters;
}
Type [] types = new Type [pi.Length];
}
return method != null ?
- new ParametersCollection (par, types, method, is_params) :
- new ParametersCollection (par, types);
+ new ParametersImported (par, types, method, is_params) :
+ new ParametersImported (par, types);
}
}
/// <summary>
/// Represents the methods parameters
/// </summary>
- public class Parameters : AParametersCollection {
- public static readonly Parameters EmptyReadOnlyParameters = new Parameters ();
+ public class ParametersCompiled : AParametersCollection
+ {
+ public static readonly ParametersCompiled EmptyReadOnlyParameters = new ParametersCompiled ();
// Used by C# 2.0 delegates
- public static readonly Parameters Undefined = new Parameters ();
+ public static readonly ParametersCompiled Undefined = new ParametersCompiled ();
- private Parameters ()
+ private ParametersCompiled ()
{
parameters = new Parameter [0];
types = Type.EmptyTypes;
}
- private Parameters (Parameter [] parameters, Type [] types)
+ private ParametersCompiled (Parameter [] parameters, Type [] types)
{
this.parameters = parameters;
this.types = types;
}
- public Parameters (params Parameter[] parameters)
+ public ParametersCompiled (params Parameter[] parameters)
{
if (parameters == null)
throw new ArgumentException ("Use EmptyReadOnlyParameters");
}
}
- public Parameters (Parameter [] parameters, bool has_arglist) :
+ public ParametersCompiled (Parameter [] parameters, bool has_arglist) :
this (parameters)
{
this.has_arglist = has_arglist;
}
- public static Parameters CreateFullyResolved (Parameter p, Type type)
+ public static ParametersCompiled CreateFullyResolved (Parameter p, Type type)
{
- return new Parameters (new Parameter [] { p }, new Type [] { type });
+ return new ParametersCompiled (new Parameter [] { p }, new Type [] { type });
}
- public static Parameters CreateFullyResolved (Parameter[] parameters, Type[] types)
+ public static ParametersCompiled CreateFullyResolved (Parameter[] parameters, Type[] types)
{
- return new Parameters (parameters, types);
+ return new ParametersCompiled (parameters, types);
}
- public static Parameters MergeGenerated (Parameters userParams, bool checkConflicts, Parameter compilerParams, Type compilerTypes)
+ public static ParametersCompiled MergeGenerated (ParametersCompiled userParams, bool checkConflicts, Parameter compilerParams, Type compilerTypes)
{
return MergeGenerated (userParams, checkConflicts,
new Parameter [] { compilerParams },
//
// Use this method when you merge compiler generated parameters with user parameters
//
- public static Parameters MergeGenerated (Parameters userParams, bool checkConflicts, Parameter[] compilerParams, Type[] compilerTypes)
+ public static ParametersCompiled MergeGenerated (ParametersCompiled userParams, bool checkConflicts, Parameter[] compilerParams, Type[] compilerTypes)
{
Parameter[] all_params = new Parameter [userParams.Count + compilerParams.Length];
userParams.FixedParameters.CopyTo(all_params, 0);
++last_filled;
}
- Parameters parameters = new Parameters (all_params, all_types);
+ ParametersCompiled parameters = new ParametersCompiled (all_params, all_types);
parameters.has_params = userParams.has_params;
return parameters;
}
"[]", initializers, loc);
}
- public Parameters Clone ()
+ public ParametersCompiled Clone ()
{
- Parameters p = (Parameters) MemberwiseClone ();
+ ParametersCompiled p = (ParametersCompiled) MemberwiseClone ();
p.parameters = new IParameterData [parameters.Length];
for (int i = 0; i < Count; ++i)
return null;
Type ret_type = method.method.ReturnType;
- Parameters args = method.method.ParameterInfo;
+ ParametersCompiled args = method.method.ParameterInfo;
int arg_len = args.Count;
bool is_indexer = method.method is Indexer.SetIndexerMethod || method.method is Indexer.GetIndexerMethod;
for (int i = 0; i < param.Count; i++) {
string name = param.FixedParameters [i].Name;
- ParameterAttributes attr = Parameters.GetParameterAttribute (param.FixedParameters [i].ModFlags);
+ ParameterAttributes attr = ParametersCompiled.GetParameterAttribute (param.FixedParameters [i].ModFlags);
proxy.DefineParameter (i + 1, attr, name);
}
public class ToplevelBlock : ExplicitBlock {
GenericMethod generic;
FlowBranchingToplevel top_level_branching;
- protected Parameters parameters;
+ protected ParametersCompiled parameters;
ToplevelParameterInfo[] parameter_info;
LocalInfo this_variable;
//
// The parameters for the block.
//
- public Parameters Parameters {
+ public ParametersCompiled Parameters {
get { return parameters; }
}
get { return Parent == null ? null : Parent.Toplevel; }
}
- public ToplevelBlock (Block parent, Parameters parameters, Location start) :
+ public ToplevelBlock (Block parent, ParametersCompiled parameters, Location start) :
this (parent, (Flags) 0, parameters, start)
{
}
- public ToplevelBlock (Block parent, Parameters parameters, GenericMethod generic, Location start) :
+ public ToplevelBlock (Block parent, ParametersCompiled parameters, GenericMethod generic, Location start) :
this (parent, parameters, start)
{
this.generic = generic;
}
- public ToplevelBlock (Parameters parameters, Location start) :
+ public ToplevelBlock (ParametersCompiled parameters, Location start) :
this (null, (Flags) 0, parameters, start)
{
}
- ToplevelBlock (Flags flags, Parameters parameters, Location start) :
+ ToplevelBlock (Flags flags, ParametersCompiled parameters, Location start) :
this (null, flags, parameters, start)
{
}
// We use 'Parent' to hook up to the containing block, but don't want to register the current block as a child.
// So, we use a two-stage setup -- first pass a null parent to the base constructor, and then override 'Parent'.
- public ToplevelBlock (Block parent, Flags flags, Parameters parameters, Location start) :
+ public ToplevelBlock (Block parent, Flags flags, ParametersCompiled parameters, Location start) :
base (null, flags, start, Location.Null)
{
this.Toplevel = this;
}
public ToplevelBlock (Location loc)
- : this (null, (Flags) 0, Parameters.EmptyReadOnlyParameters, loc)
+ : this (null, (Flags) 0, ParametersCompiled.EmptyReadOnlyParameters, loc)
{
}
return this_variable == null || this_variable.IsThisAssigned (ec);
}
- public bool ResolveMeta (EmitContext ec, Parameters ip)
+ public bool ResolveMeta (EmitContext ec, ParametersCompiled ip)
{
int errors = Report.Errors;
int orig_count = parameters.Count;
TypeManager.CSharpName (mb.DeclaringType) + "." + mb.Name);
}
- pd = ParametersCollection.Create (mb);
+ pd = ParametersImported.Create (mb);
#else
MethodBase generic = TypeManager.DropGenericMethodArguments (mb);
if (generic != mb) {
pd = TypeManager.GetParameterData (generic);
- pd = ParametersCollection.Create (pd, mb);
+ pd = ParametersImported.Create (pd, mb);
} else {
- pd = ParametersCollection.Create (mb);
+ pd = ParametersImported.Create (mb);
}
#endif
method_params.Add (mb, pd);
AParametersCollection pd = (AParametersCollection)method_params [pi];
if (pd == null) {
if (pi is PropertyBuilder)
- return Parameters.EmptyReadOnlyParameters;
+ return ParametersCompiled.EmptyReadOnlyParameters;
ParameterInfo [] p = pi.GetIndexParameters ();
if (p == null)
- return Parameters.EmptyReadOnlyParameters;
+ return ParametersCompiled.EmptyReadOnlyParameters;
- pd = ParametersCollection.Create (p, null);
+ pd = ParametersImported.Create (p, null);
method_params.Add (pi, pd);
}