internal override InvalidInfo CheckValid(ValidityContext vctxt, MessageContext ctxt, RootEnvironment rootEnv) { var v = base.CheckValid(vctxt, ctxt, rootEnv); if (v != null) { return(v); } var typeEnv = DefiningType.Enter(rootEnv); var methodDef = typeEnv.Type.ResolveMethod(signature); if (methodDef == null) { vctxt.Log(new InvalidMemberRef(ctxt, this, "No such method in defining type")); return(new InvalidInfo(MessageContextBuilders.Member(vctxt.Global, this))); } var methEnv = typeEnv.AddMethod(methodDef).AddSelfMethodBoundArguments(); v = signature.CheckValid(vctxt, ctxt, methEnv); if (v != null) { return(v); } return(vctxt.ImplementableMemberRef(ctxt, rootEnv, this)); }
public EventEnvironment Enter(RootEnvironment rootEnv) { var typeEnv = DefiningType.Enter(rootEnv); var eventDef = typeEnv.Type.ResolveEvent(signature); if (eventDef == null) { throw new InvalidOperationException("unable to resolve event reference"); } return(typeEnv.AddEvent(eventDef)); }
public PropertyEnvironment Enter(RootEnvironment rootEnv) { var typeEnv = DefiningType.Enter(rootEnv); var propDef = typeEnv.Type.ResolveProperty(signature); if (propDef == null) { throw new InvalidOperationException("unable to resolve property reference"); } return(typeEnv.AddProperty(propDef)); }
public FieldEnvironment Enter(RootEnvironment rootEnv) { var typeEnv = DefiningType.Enter(rootEnv); var fieldDef = typeEnv.Type.ResolveField(signature); if (fieldDef == null) { throw new InvalidOperationException("unable to resolve field reference"); } return(typeEnv.AddField(fieldDef)); }
public PolymorphicMethodEnvironment Enter(RootEnvironment rootEnv) { var typeEnv = DefiningType.Enter(rootEnv); var methodDef = typeEnv.Type.ResolveMethod(signature); if (methodDef == null) { throw new InvalidOperationException("unable to resolve polymorphic method reference"); } return(typeEnv.AddMethod(methodDef)); }
public MethodEnvironment EnterMethod(RootEnvironment rootEnv) { var typeEnv = DefiningType.Enter(rootEnv); var methodDef = typeEnv.Type.ResolveMethod(signature); if (methodDef == null) { throw new InvalidOperationException("unable to resolve method reference"); } var groundArguments = rootEnv.SubstituteTypes(MethodTypeArguments); return(typeEnv.AddMethod(methodDef).AddMethodBoundArguments(groundArguments)); }
internal override InvalidInfo CheckValid(ValidityContext vctxt, MessageContext ctxt, RootEnvironment rootEnv) { var v = base.CheckValid(vctxt, ctxt, rootEnv); if (v != null) { return(v); } if (MethodTypeArguments.Count != MethodTypeArity) { vctxt.Log (new InvalidMemberRef (ctxt, this, String.Format ("Polymorphic method has {0} type parameters but is applied to {1} type arguments", MethodTypeArity, MethodTypeArguments.Count))); return(new InvalidInfo(MessageContextBuilders.Member(vctxt.Global, this))); } v = MethodTypeArguments.Select(t => t.CheckValid(vctxt, ctxt, rootEnv)).FirstOrDefault(v2 => v2 != null); if (v != null) { return(v); } var groundMethodTypeArguments = rootEnv.SubstituteTypes(MethodTypeArguments); var typeEnv = DefiningType.Enter(rootEnv); var methodDef = typeEnv.Type.ResolveMethod(signature); if (methodDef == null) { throw new InvalidOperationException("unable to resolve method"); } var methEnv = typeEnv.AddMethod(methodDef).AddMethodBoundArguments(groundMethodTypeArguments); return(signature.CheckValid(vctxt, ctxt, methEnv)); }
internal override InvalidInfo CheckValid(ValidityContext vctxt, MessageContext ctxt, RootEnvironment rootEnv) { var v = base.CheckValid(vctxt, ctxt, rootEnv); if (v != null) { return(v); } var typeEnv = DefiningType.Enter(rootEnv); var eventDef = typeEnv.Type.ResolveMember(signature); if (eventDef == null) { throw new InvalidOperationException("unable to resolve event"); } v = signature.CheckValid(vctxt, ctxt, typeEnv); if (v != null) { return(v); } return(vctxt.ImplementableMemberRef(ctxt, rootEnv, this)); }