using System;
using System.Reflection;
-using System.Collections;
+using System.Collections.Generic;
namespace Mono.CSharp.Linq
{
return next.BuildQueryClause (ec, lSide);
}
- public override Expression DoResolve (ResolveContext ec)
+ protected override Expression DoResolve (ResolveContext ec)
{
int counter = QueryBlock.TransparentParameter.Counter;
return rmg;
}
- public bool AmbiguousCall (ResolveContext ec, MethodBase ambiguous)
+ public bool AmbiguousCall (ResolveContext ec, MethodSpec ambiguous)
{
- ec.Report.SymbolRelatedToPreviousError ((MethodInfo) mg);
- ec.Report.SymbolRelatedToPreviousError (ambiguous);
+ ec.Report.SymbolRelatedToPreviousError (mg.BestCandidate.MetaInfo);
+ ec.Report.SymbolRelatedToPreviousError (ambiguous.MetaInfo);
ec.Report.Error (1940, loc, "Ambiguous implementation of the query pattern `{0}' for source type `{1}'",
mg.Name, mg.InstanceExpression.GetSignatureForError ());
return true;
}
- public bool NoExactMatch (ResolveContext ec, MethodBase method)
+ public bool NoExactMatch (ResolveContext ec, MethodSpec method)
{
- AParametersCollection pd = TypeManager.GetParameterData (method);
+ var pd = method.Parameters;
Type source_type = pd.ExtensionMethodType;
if (source_type != null) {
Argument a = arguments [0];
}
}
- if (!TypeManager.IsGenericMethod (method))
+ if (!method.IsGenericMethod)
return false;
if (mg.Name == "SelectMany") {
t.next = (AQueryClause) next.Clone (clonectx);
}
- public override Expression DoResolve (ResolveContext ec)
+ protected override Expression DoResolve (ResolveContext ec)
{
- return expr.DoResolve (ec);
+ return expr.Resolve (ec);
}
public virtual Expression BuildQueryClause (ResolveContext ec, Expression lSide)
{
sealed class RangeAnonymousTypeParameter : AnonymousTypeParameter
{
- public RangeAnonymousTypeParameter (Expression initializer, LocatedToken parameter)
+ public RangeAnonymousTypeParameter (Expression initializer, SimpleMemberName parameter)
: base (initializer, parameter.Value, parameter.Location)
{
}
{
}
- protected static Expression CreateRangeVariableType (ToplevelBlock block, IMemberContext context, LocatedToken name, Expression init)
+ protected static Expression CreateRangeVariableType (ToplevelBlock block, IMemberContext context, SimpleMemberName name, Expression init)
{
- ArrayList args = new ArrayList (2);
+ var args = new List<AnonymousTypeParameter> (2);
args.Add (new AnonymousTypeParameter (block.Parameters [0]));
args.Add (new RangeAnonymousTypeParameter (init, name));
return new NewAnonymousType (args, context.CurrentTypeDefinition, name.Location);
return next.BuildQueryClause (ec, expr);
}
- public override Expression DoResolve (ResolveContext ec)
+ protected override Expression DoResolve (ResolveContext ec)
{
Expression e = BuildQueryClause (ec, null);
return e.Resolve (ec);
class Join : ARangeVariableQueryClause
{
- readonly LocatedToken lt;
+ readonly SimpleMemberName lt;
ToplevelBlock inner_selector, outer_selector;
- public Join (ToplevelBlock block, LocatedToken lt, Expression inner, ToplevelBlock outerSelector, ToplevelBlock innerSelector, Location loc)
+ public Join (ToplevelBlock block, SimpleMemberName lt, Expression inner, ToplevelBlock outerSelector, ToplevelBlock innerSelector, Location loc)
: base (block, inner)
{
this.lt = lt;
args.Add (new Argument (lambda));
Expression result_selector_expr;
- LocatedToken into_variable = GetIntoVariable ();
+ SimpleMemberName into_variable = GetIntoVariable ();
//
// When select follows use is as result selector
//
args.Add (new Argument (result_selector));
}
- protected virtual LocatedToken GetIntoVariable ()
+ protected virtual SimpleMemberName GetIntoVariable ()
{
return lt;
}
class GroupJoin : Join
{
- readonly LocatedToken into;
+ readonly SimpleMemberName into;
- public GroupJoin (ToplevelBlock block, LocatedToken lt, Expression inner,
- ToplevelBlock outerSelector, ToplevelBlock innerSelector, LocatedToken into, Location loc)
+ public GroupJoin (ToplevelBlock block, SimpleMemberName lt, Expression inner,
+ ToplevelBlock outerSelector, ToplevelBlock innerSelector, SimpleMemberName into, Location loc)
: base (block, lt, inner, outerSelector, innerSelector, loc)
{
this.into = into;
}
- protected override LocatedToken GetIntoVariable ()
+ protected override SimpleMemberName GetIntoVariable ()
{
return into;
}
class Let : ARangeVariableQueryClause
{
- public Let (ToplevelBlock block, TypeContainer container, LocatedToken identifier, Expression expr)
+ public Let (ToplevelBlock block, TypeContainer container, SimpleMemberName identifier, Expression expr)
: base (block, CreateRangeVariableType (block, container, identifier, expr))
{
}
class SelectMany : ARangeVariableQueryClause
{
- LocatedToken lt;
+ SimpleMemberName lt;
- public SelectMany (ToplevelBlock block, LocatedToken lt, Expression expr)
+ public SelectMany (ToplevelBlock block, SimpleMemberName lt, Expression expr)
: base (block, expr)
{
this.lt = lt;
public readonly ParametersCompiled Parent;
public readonly string Identifier;
- public TransparentParameter (ParametersCompiled parent, LocatedToken identifier)
+ public TransparentParameter (ParametersCompiled parent, SimpleMemberName identifier)
: base (ParameterNamePrefix + Counter++, identifier.Location)
{
Parent = parent;
}
}
- public QueryBlock (CompilerContext ctx, Block parent, LocatedToken lt, Location start)
+ public QueryBlock (CompilerContext ctx, Block parent, SimpleMemberName lt, Location start)
: base (ctx, parent, new ParametersCompiled (ctx, new ImplicitQueryParameter (lt.Value, lt.Location)), start)
{
if (parent != null)
base.CheckParentConflictName (parent.Toplevel, lt.Value, lt.Location);
}
- public QueryBlock (CompilerContext ctx, Block parent, ParametersCompiled parameters, LocatedToken lt, Location start)
+ public QueryBlock (CompilerContext ctx, Block parent, ParametersCompiled parameters, SimpleMemberName lt, Location start)
: base (ctx, parent, new ParametersCompiled (ctx, parameters [0].Clone (), new ImplicitQueryParameter (lt.Value, lt.Location)), start)
{
}
{
}
- public void AddTransparentParameter (CompilerContext ctx, LocatedToken name)
+ public void AddTransparentParameter (CompilerContext ctx, SimpleMemberName name)
{
base.CheckParentConflictName (this, name.Value, name.Location);