Microsoft.CSharp.RuntimeBinder.Semantics.ExpressionBinder
class ExpressionBinder
namespace Microsoft.CSharp.RuntimeBinder.Semantics
{
internal class ExpressionBinder
{
protected class BinOpArgInfo
{
public EXPR arg1;
public EXPR arg2;
public PredefinedType pt1;
public PredefinedType pt2;
public PredefinedType ptRaw1;
public PredefinedType ptRaw2;
public CType type1;
public CType type2;
public CType typeRaw1;
public CType typeRaw2;
public BinOpKind binopKind;
public BinOpMask mask;
public BinOpArgInfo(EXPR op1, EXPR op2);
public bool ValidForDelegate();
public bool ValidForEnumAndUnderlyingType();
public bool ValidForUnderlyingTypeAndEnum();
public bool ValidForEnum();
public bool ValidForPointer();
public bool ValidForVoidPointer();
public bool ValidForPointerAndNumber();
public bool ValidForNumberAndPointer();
}
protected class BinOpSig
{
public PredefinedType pt1;
public PredefinedType pt2;
public BinOpMask mask;
public int cbosSkip;
public PfnBindBinOp pfn;
public OpSigFlags grfos;
public BinOpFuncKind fnkind;
public BinOpSig();
public BinOpSig(PredefinedType pt1, PredefinedType pt2, BinOpMask mask, int cbosSkip, PfnBindBinOp pfn, OpSigFlags grfos, BinOpFuncKind fnkind);
public bool ConvertOperandsBeforeBinding();
public bool CanLift();
public bool AutoLift();
}
protected class BinOpFullSig : BinOpSig
{
public BinOpFullSig(CType type1, CType type2, PfnBindBinOp pfn, OpSigFlags grfos, LiftFlags grflt, BinOpFuncKind fnkind);
public BinOpFullSig(ExpressionBinder fnc, BinOpSig bos);
public bool FPreDef();
public bool isLifted();
public bool ConvertFirst();
public bool ConvertSecond();
public CType Type1();
public CType Type2();
}
private delegate bool ConversionFunc (EXPR pSourceExpr, CType pSourceType, EXPRTYPEORNAMESPACE pDestinationTypeExpr, CType pDestinationTypeForLambdaErrorReporting, bool needsExprDest, out EXPR ppDestinationExpr, CONVERTTYPE flags);
protected delegate EXPR PfnBindBinOp (ExpressionKind ek, EXPRFLAG flags, EXPR op1, EXPR op2);
protected delegate EXPR PfnBindUnaOp (ExpressionKind ek, EXPRFLAG flags, EXPR op);
protected class UnaOpSig
{
public PredefinedType pt;
public UnaOpMask grfuom;
public int cuosSkip;
public PfnBindUnaOp pfn;
public UnaOpFuncKind fnkind;
public UnaOpSig();
public UnaOpSig(PredefinedType pt, UnaOpMask grfuom, int cuosSkip, PfnBindUnaOp pfn, UnaOpFuncKind fnkind);
}
protected class UnaOpFullSig : UnaOpSig
{
public UnaOpFullSig(CType type, PfnBindUnaOp pfn, LiftFlags grflt, UnaOpFuncKind fnkind);
public UnaOpFullSig(ExpressionBinder fnc, UnaOpSig uos);
public bool FPreDef();
public bool isLifted();
public bool Convert();
public new CType GetType();
}
protected BindingContext Context;
protected CNullable m_nullable;
protected readonly BinOpSig[] g_binopSignatures;
protected readonly UnaOpSig[] g_rguos;
protected SymbolLoader SymbolLoader { get; }
protected CSemanticChecker SemanticChecker { get; }
protected TypeManager TypeManager { get; }
protected CType VoidType { get; }
protected BetterType WhichMethodIsBetterTieBreaker(CandidateFunctionMember node1, CandidateFunctionMember node2, CType pTypeThrough, ArgInfos args);
protected BetterType WhichMethodIsBetter(CandidateFunctionMember node1, CandidateFunctionMember node2, CType pTypeThrough, ArgInfos args);
protected BetterType WhichConversionIsBetter(EXPR arg, CType argType, CType p1, CType p2);
public BetterType WhichConversionIsBetter(CType argType, CType p1, CType p2);
protected CandidateFunctionMember FindBestMethod(List<CandidateFunctionMember> list, CType pTypeThrough, ArgInfos args, out CandidateFunctionMember methAmbig1, out CandidateFunctionMember methAmbig2);
protected void ReportLocalError(LocalVariableSymbol local, CheckLvalueKind kind, bool isNested);
protected void ReportReadOnlyError(EXPRFIELD field, CheckLvalueKind kind, bool isNested);
protected bool TryReportLvalueFailure(EXPR expr, CheckLvalueKind kind);
public static void ReportTypeArgsNotAllowedError(SymbolLoader symbolLoader, int arity, ErrArgRef argName, ErrArgRef argKind);
public bool canConvert(CType src, CType dest, CONVERTTYPE flags);
public bool canConvert(CType src, CType dest);
public bool canConvert(EXPR expr, CType dest);
public bool canConvert(EXPR expr, CType dest, CONVERTTYPE flags);
public EXPR mustConvertCore(EXPR expr, EXPRTYPEORNAMESPACE destExpr);
public EXPR mustConvertCore(EXPR expr, EXPRTYPEORNAMESPACE destExpr, CONVERTTYPE flags);
public EXPR tryConvert(EXPR expr, CType dest);
public EXPR tryConvert(EXPR expr, CType dest, CONVERTTYPE flags);
public EXPR mustConvert(EXPR expr, CType dest);
public EXPR mustConvert(EXPR expr, CType dest, CONVERTTYPE flags);
public EXPR mustConvert(EXPR expr, EXPRTYPEORNAMESPACE dest, CONVERTTYPE flags);
public EXPR mustCast(EXPR expr, CType dest);
public EXPR mustCast(EXPR expr, CType dest, CONVERTTYPE flags);
public bool BindGrpConversion(EXPRMEMGRP grp, CType typeDst, bool fReportErrors);
public bool BindGrpConversion(EXPRMEMGRP grp, CType typeDst, bool needDest, out EXPRCALL pexprDst, bool fReportErrors);
public BindingContext GetContext();
public ExpressionBinder(BindingContext context);
protected SymbolLoader GetSymbolLoader();
public CSemanticChecker GetSemanticChecker();
protected BSYMMGR GetGlobalSymbols();
protected TypeManager GetTypes();
protected AggregateType GetReqPDT(PredefinedType pt);
protected static AggregateType GetReqPDT(PredefinedType pt, SymbolLoader symbolLoader);
protected AggregateType GetOptPDT(PredefinedType pt);
protected AggregateType GetOptPDT(PredefinedType pt, bool WarnIfNotFound);
protected CType getVoidType();
public EXPR GenerateAssignmentConversion(EXPR op1, EXPR op2, bool allowExplicit);
public EXPR bindAssignment(EXPR op1, EXPR op2, bool allowExplicit);
protected EXPRUNARYOP bindPtrToString(EXPR string);
protected EXPRQUESTIONMARK BindPtrToArray(EXPRLOCAL exprLoc, EXPR array);
protected EXPR bindIndexer(EXPR pObject, EXPR args, BindingFlag bindFlags);
public void bindSimpleCast(EXPR exprSrc, EXPRTYPEORNAMESPACE typeDest, out EXPR pexprDest);
public void bindSimpleCast(EXPR exprSrc, EXPRTYPEORNAMESPACE exprTypeDest, out EXPR pexprDest, EXPRFLAG exprFlags);
protected EXPR BadOperatorTypesError(ExpressionKind ek, EXPR pOperand1, EXPR pOperand2);
protected EXPR BadOperatorTypesError(ExpressionKind ek, EXPR pOperand1, EXPR pOperand2, CType pTypeErr);
protected EXPR UnwrapExpression(EXPR pExpression);
protected void CheckLvalueProp(EXPRPROP prop);
protected bool CheckPropertyAccess(MethWithType mwt, PropWithType pwtSlot, CType type);
protected void PostBindProperty(bool fBaseCall, PropWithType pwt, EXPR pObject, out MethWithType pmwtGet, out MethWithType pmwtSet);
public static void RemapToOverride(SymbolLoader symbolLoader, SymWithType pswt, CType typeObj);
protected void verifyMethodArgs(EXPR call, CType callingObjectType);
protected void AdjustCallArgumentsForParams(CType callingObjectType, CType type, MethodOrPropertySymbol mp, TypeArray pTypeArgs, EXPR argsPtr, out EXPR newArgs);
protected void markFieldAssigned(EXPR expr);
protected void SetExternalRef(CType type);
protected bool TryGetExpandedParams(TypeArray params, int count, out TypeArray ppExpandedParams);
public static bool IsMethPropCallable(MethodOrPropertySymbol sym, bool requireUC);
public static bool isConstantInRange(EXPRCONSTANT exprSrc, CType typeDest);
public static bool isConstantInRange(EXPRCONSTANT exprSrc, CType typeDest, bool realsOk);
protected Name ekName(ExpressionKind ek);
public void checkUnsafe(CType type);
public void checkUnsafe(CType type, ErrorCode errCode, ErrArg pArg);
protected bool InMethod();
protected bool InStaticMethod();
protected bool InConstructor();
protected bool InAnonymousMethod();
protected bool InFieldInitializer();
protected AggregateSymbol ContainingAgg();
protected bool isThisPointer(EXPR expr);
protected bool RespectReadonly();
protected bool isUnsafeContext();
protected bool ReportUnsafeErrors();
protected virtual void RecordUnsafeUsage();
protected virtual EXPR WrapShortLivedExpression(EXPR expr);
protected virtual EXPR GenerateOptimizedAssignment(EXPR op1, EXPR op2);
public static void RecordUnsafeUsage(BindingContext context);
protected EXPR bindUserDefinedBinOp(ExpressionKind ek, BinOpArgInfo info);
protected bool GetSpecialBinopSignatures(List<BinOpFullSig> prgbofs, BinOpArgInfo info);
protected bool GetStandardAndLiftedBinopSignatures(List<BinOpFullSig> rgbofs, BinOpArgInfo info);
protected int FindBestSignatureInList(List<BinOpFullSig> binopSignatures, BinOpArgInfo info);
protected EXPRBINOP bindNullEqualityComparison(ExpressionKind ek, BinOpArgInfo info);
public EXPR BindStandardBinop(ExpressionKind ek, EXPR arg1, EXPR arg2);
protected EXPR BindStandardBinopCore(BinOpArgInfo info, BinOpFullSig bofs, ExpressionKind ek, EXPRFLAG flags);
protected bool GetDelBinOpSigs(List<BinOpFullSig> prgbofs, BinOpArgInfo info);
protected bool GetEnumBinOpSigs(List<BinOpFullSig> prgbofs, BinOpArgInfo info);
protected bool GetPtrBinOpSigs(List<BinOpFullSig> prgbofs, BinOpArgInfo info);
protected bool GetRefEqualSigs(List<BinOpFullSig> prgbofs, BinOpArgInfo info);
public EXPR BindStandardUnaryOperator(OperatorKind op, EXPR pArgument);
}
}