Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ internal enum ErrorCode
ERR_RefConstraintNotSatisfied = 452,
ERR_ValConstraintNotSatisfied = 453,
ERR_AmbigUDConv = 457,
ERR_PredefinedTypeNotFound = 518,
ERR_BindToBogus = 570,
ERR_CantCallSpecialMethod = 571,
ERR_BogusType = 648,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ public static string GetMessage(ErrorCode code)
case ErrorCode.ERR_AmbigUDConv:
codeStr = SR.AmbigUDConv;
break;
case ErrorCode.ERR_PredefinedTypeNotFound:
codeStr = SR.PredefinedTypeNotFound;
break;
case ErrorCode.ERR_BindToBogus:
codeStr = SR.BindToBogus;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ private ExprMemberGroup CreateMemberGroupEXPR(
CType callingObjectType = callingObject.Type;
if (callingObjectType is ArrayType)
{
callingType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_ARRAY);
callingType = _semanticChecker.GetSymbolLoader().GetPredefindType(PredefinedType.PT_ARRAY);
}
else if (callingObjectType is NullableType callingNub)
{
Expand Down Expand Up @@ -1173,7 +1173,7 @@ internal Expr BindUnaryOperation(
{
// For true and false, we try to convert to bool first. If that
// doesn't work, then we look for user defined operators.
Expr result = _binder.tryConvert(arg1, SymbolLoader.GetReqPredefType(PredefinedType.PT_BOOL));
Expr result = _binder.tryConvert(arg1, SymbolLoader.GetPredefindType(PredefinedType.PT_BOOL));
if (result != null && op == OperatorKind.OP_FALSE)
{
// If we can convert to bool, we need to negate the thing if we're looking for false.
Expand All @@ -1190,7 +1190,7 @@ internal Expr BindUnaryOperation(
// the error.
if (result == null)
{
result = _binder.mustConvert(arg1, SymbolLoader.GetReqPredefType(PredefinedType.PT_BOOL));
result = _binder.mustConvert(arg1, SymbolLoader.GetPredefindType(PredefinedType.PT_BOOL));
}
return result;
}
Expand Down Expand Up @@ -1438,7 +1438,7 @@ internal Expr BindImplicitConversion(
CType pDestType = _binder.chooseArrayIndexType(argument);
if (null == pDestType)
{
pDestType = SymbolLoader.GetReqPredefType(PredefinedType.PT_INT);
pDestType = SymbolLoader.GetPredefindType(PredefinedType.PT_INT);
}

return _binder.mustCast(
Expand Down Expand Up @@ -1527,7 +1527,7 @@ internal Expr BindIsEvent(

Expr callingObject = CreateLocal(arguments[0].Type, false, locals[0]);
MemberLookup mem = new MemberLookup();
CType boolType = SymbolLoader.GetReqPredefType(PredefinedType.PT_BOOL);
CType boolType = SymbolLoader.GetPredefindType(PredefinedType.PT_BOOL);
bool result = false;

if (arguments[0].Value == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public BinOpFullSig(ExpressionBinder fnc, BinOpSig bos)
this.grfos = bos.grfos;
this.fnkind = bos.fnkind;

_type1 = pt1 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetOptPDT(pt1) : null;
_type2 = pt2 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetOptPDT(pt2) : null;
_type1 = pt1 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetPredefindType(pt1) : null;
_type2 = pt2 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetPredefindType(pt2) : null;
_grflt = LiftFlags.None;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ private void CheckBetterTable()
(s_simpleTypeBetter[i][j] == right && s_simpleTypeBetter[j][i] == left) ||
(s_simpleTypeBetter[i][j] == neither && s_simpleTypeBetter[j][i] == neither));
Debug.Assert(
GetOptPDT((PredefinedType)i) == null ||
GetOptPDT((PredefinedType)j) == null ||
(!canConvert(GetOptPDT((PredefinedType)i), GetOptPDT((PredefinedType)j), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[i][j] == left) &&
(!canConvert(GetOptPDT((PredefinedType)j), GetOptPDT((PredefinedType)i), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[j][i] == left));
GetPredefindType((PredefinedType)i) == null ||
GetPredefindType((PredefinedType)j) == null ||
(!canConvert(GetPredefindType((PredefinedType)i), GetPredefindType((PredefinedType)j), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[i][j] == left) &&
(!canConvert(GetPredefindType((PredefinedType)j), GetPredefindType((PredefinedType)i), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[j][i] == left));
}
}
s_fCheckedBetter = true;
Expand Down Expand Up @@ -279,7 +279,7 @@ private BetterType WhichTypeIsBetter(PredefinedType pt1, PredefinedType pt2, CTy
{
return BetterType.Right;
}
return WhichTypeIsBetter(GetOptPDT(pt1), GetOptPDT(pt2), typeGiven);
return WhichTypeIsBetter(GetPredefindType(pt1), GetPredefindType(pt2), typeGiven);
}


Expand Down Expand Up @@ -766,7 +766,7 @@ private bool BindGrpConversion(ExprMemberGroup grp, CType typeDst, bool needDest
if (obj != null && obj.Type.fundType() != FUNDTYPE.FT_REF)
{
// Must box the object before creating a delegate to it.
obj = mustConvert(obj, GetReqPDT(PredefinedType.PT_OBJECT));
obj = mustConvert(obj, GetPredefindType(PredefinedType.PT_OBJECT));
}
}
else
Expand Down Expand Up @@ -1693,7 +1693,7 @@ private int CompareDstTypesBased(CType type1, bool fImplicit1, CType type2, bool
private Expr bindDecimalConstCast(ExprClass exprDestType, CType srcType, ExprConstant src)
{
CType destType = exprDestType.Type;
CType typeDecimal = SymbolLoader.GetOptPredefType(PredefinedType.PT_DECIMAL);
CType typeDecimal = SymbolLoader.GetPredefindType(PredefinedType.PT_DECIMAL);
ConstVal cv;

if (typeDecimal == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public static bool FExpRefConv(SymbolLoader loader, CType typeSrc, CType typeDst
return false;
}

AggregateSymbol aggIList = loader.GetOptPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = loader.GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST);
AggregateSymbol aggIList = loader.GetPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = loader.GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST);

if ((aggIList == null ||
!loader.IsBaseAggregate(aggIList, aggDst.getAggregate())) &&
Expand All @@ -160,7 +160,7 @@ public static bool FExpRefConv(SymbolLoader loader, CType typeSrc, CType typeDst
if (typeDst is ArrayType arrayDest && typeSrc is AggregateType aggtypeSrc)
{
// * From System.Array and the interfaces it implements, to any array-type.
if (loader.HasIdentityOrImplicitReferenceConversion(loader.GetReqPredefType(PredefinedType.PT_ARRAY), typeSrc))
if (loader.HasIdentityOrImplicitReferenceConversion(loader.GetPredefindType(PredefinedType.PT_ARRAY), typeSrc))
{
return true;
}
Expand All @@ -175,8 +175,8 @@ public static bool FExpRefConv(SymbolLoader loader, CType typeSrc, CType typeDst
return false;
}

AggregateSymbol aggIList = loader.GetOptPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = loader.GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST);
AggregateSymbol aggIList = loader.GetPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = loader.GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST);

if ((aggIList == null ||
!loader.IsBaseAggregate(aggIList, aggtypeSrc.getAggregate())) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ private bool bindExplicitConversionFromArrayToIList()
return false;
}

AggregateSymbol aggIList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST);
AggregateSymbol aggIList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST);

if ((aggIList == null ||
!GetSymbolLoader().IsBaseAggregate(aggIList, aggDest.getAggregate())) &&
Expand Down Expand Up @@ -297,7 +297,7 @@ private bool bindExplicitConversionToTypeVar()
{
// Need to box first before unboxing.
Expr exprT;
ExprClass exprObj = GetExprFactory().CreateClass(_binder.GetReqPDT(PredefinedType.PT_OBJECT));
ExprClass exprObj = GetExprFactory().CreateClass(_binder.GetPredefindType(PredefinedType.PT_OBJECT));
_binder.bindSimpleCast(_exprSrc, exprObj, out exprT, EXPRFLAG.EXF_FORCE_BOX);
_exprSrc = exprT;
}
Expand Down Expand Up @@ -325,8 +325,8 @@ private bool bindExplicitConversionFromIListToArray(ArrayType arrayDest)
return false;
}

AggregateSymbol aggIList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST);
AggregateSymbol aggIList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_ILIST);
AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST);

if ((aggIList == null ||
!GetSymbolLoader().IsBaseAggregate(aggIList, aggSrc.getAggregate())) &&
Expand Down Expand Up @@ -399,7 +399,7 @@ private bool bindExplicitConversionToArray(ArrayType arrayDest)
//
// * From System.Array and the interfaces it implements, to any array-type.

if (_binder.canConvert(_binder.GetReqPDT(PredefinedType.PT_ARRAY), _typeSrc, CONVERTTYPE.NOUDC))
if (_binder.canConvert(_binder.GetPredefindType(PredefinedType.PT_ARRAY), _typeSrc, CONVERTTYPE.NOUDC))
{
if (_needsExprDest)
_binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_REFCHECK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,26 @@ public ExprBoundLambda CreateAnonymousMethod(AggregateType delegateType, Scope a
new ExprBoundLambda(delegateType, argumentScope);

public ExprHoistedLocalExpr CreateHoistedLocalInExpression() =>
new ExprHoistedLocalExpr(Types.GetOptPredefAgg(PredefinedType.PT_EXPRESSION).getThisType());
new ExprHoistedLocalExpr(Types.GetPredefAgg(PredefinedType.PT_EXPRESSION).getThisType());

public ExprMethodInfo CreateMethodInfo(MethPropWithInst mwi) =>
CreateMethodInfo(mwi.Meth(), mwi.GetType(), mwi.TypeArgs);

public ExprMethodInfo CreateMethodInfo(MethodSymbol method, AggregateType methodType, TypeArray methodParameters)
{
return new ExprMethodInfo(
Types.GetOptPredefAgg(method.IsConstructor() ? PredefinedType.PT_CONSTRUCTORINFO : PredefinedType.PT_METHODINFO).getThisType(),
Types.GetPredefAgg(method.IsConstructor() ? PredefinedType.PT_CONSTRUCTORINFO : PredefinedType.PT_METHODINFO).getThisType(),
method, methodType, methodParameters);
}

public ExprPropertyInfo CreatePropertyInfo(PropertySymbol prop, AggregateType propertyType) =>
new ExprPropertyInfo(Types.GetOptPredefAgg(PredefinedType.PT_PROPERTYINFO).getThisType(), prop, propertyType);
new ExprPropertyInfo(Types.GetPredefAgg(PredefinedType.PT_PROPERTYINFO).getThisType(), prop, propertyType);

public ExprFieldInfo CreateFieldInfo(FieldSymbol field, AggregateType fieldType) =>
new ExprFieldInfo(field, fieldType, Types.GetOptPredefAgg(PredefinedType.PT_FIELDINFO).getThisType());
new ExprFieldInfo(field, fieldType, Types.GetPredefAgg(PredefinedType.PT_FIELDINFO).getThisType());

private ExprTypeOf CreateTypeOf(ExprClass sourceType) =>
new ExprTypeOf(Types.GetReqPredefAgg(PredefinedType.PT_TYPE).getThisType(), sourceType);
new ExprTypeOf(Types.GetPredefAgg(PredefinedType.PT_TYPE).getThisType(), sourceType);

public ExprTypeOf CreateTypeOf(CType sourceType) => CreateTypeOf(CreateClass(sourceType));

Expand All @@ -105,7 +105,7 @@ public ExprUserLogicalOp CreateUserLogOpError(CType type, Expr trueFalseCall, Ex
public ExprConcat CreateConcat(Expr first, Expr second) => new ExprConcat(first, second);

public ExprConstant CreateStringConstant(string str) =>
CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_STRING).getThisType(), ConstVal.Get(str));
CreateConstant(Types.GetPredefAgg(PredefinedType.PT_STRING).getThisType(), ConstVal.Get(str));

public ExprMultiGet CreateMultiGet(EXPRFLAG flags, CType type, ExprMulti multi) =>
new ExprMultiGet(type, flags, multi);
Expand Down Expand Up @@ -187,10 +187,10 @@ private Expr CreateZeroInit(ExprClass typeExpr, Expr originalConstructorCall, bo
public ExprConstant CreateConstant(CType type, ConstVal constVal) => new ExprConstant(type, constVal);

public ExprConstant CreateIntegerConstant(int x) =>
CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_INT).getThisType(), ConstVal.Get(x));
CreateConstant(Types.GetPredefAgg(PredefinedType.PT_INT).getThisType(), ConstVal.Get(x));

public ExprConstant CreateBoolConstant(bool b) =>
CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_BOOL).getThisType(), ConstVal.Get(b));
CreateConstant(Types.GetPredefAgg(PredefinedType.PT_BOOL).getThisType(), ConstVal.Get(b));

public ExprBlock CreateBlock(ExprStatement pOptionalStatements) => new ExprBlock(pOptionalStatements);

Expand All @@ -203,7 +203,7 @@ public ExprArrayIndex CreateArrayIndex(Expr array, Expr index)
}
else if (type == null)
{
type = Types.GetReqPredefAgg(PredefinedType.PT_INT).getThisType();
type = Types.GetPredefAgg(PredefinedType.PT_INT).getThisType();
}

return new ExprArrayIndex(type, array, index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,33 +358,11 @@ private BSYMMGR GetGlobalSymbols()

private ExprFactory ExprFactory { get { return Context.ExprFactory; } }

private AggregateType GetReqPDT(PredefinedType pt)
private AggregateType GetPredefindType(PredefinedType pt)
{
return GetReqPDT(pt, GetSymbolLoader());
}

private static AggregateType GetReqPDT(PredefinedType pt, SymbolLoader symbolLoader)
{
Debug.Assert(pt != PredefinedType.PT_VOID); // use getVoidType()
return symbolLoader.GetReqPredefType(pt);
}

private AggregateType GetOptPDT(PredefinedType pt)
{
return GetOptPDT(pt, true);
}
Debug.Assert(pt != PredefinedType.PT_VOID); // use getVoidType()

private AggregateType GetOptPDT(PredefinedType pt, bool WarnIfNotFound)
{
Debug.Assert(pt != PredefinedType.PT_VOID); // use getVoidType()
if (WarnIfNotFound)
{
return GetSymbolLoader().GetOptPredefTypeErr(pt);
}
else
{
return GetSymbolLoader().GetOptPredefType(pt);
}
return GetSymbolLoader().GetPredefindType(pt);
}

private CType VoidType { get { return GetSymbolLoader().GetTypeManager().GetVoid(); } }
Expand Down Expand Up @@ -435,7 +413,7 @@ internal Expr BindArrayIndexCore(BindingFlag bindFlags, Expr pOp1, Expr pOp2)
bIsError = true;
}

CType pIntType = GetReqPDT(PredefinedType.PT_INT);
CType pIntType = GetPredefindType(PredefinedType.PT_INT);

// Array indexing must occur on an array type.
if (!(pOp1.Type is ArrayType pArrayType))
Expand Down Expand Up @@ -1250,7 +1228,7 @@ private ExprOperator BadOperatorTypesError(ExpressionKind ek, Expr pOperand1, Ex

if (pTypeErr == null)
{
pTypeErr = GetReqPDT(PredefinedType.PT_OBJECT);
pTypeErr = GetPredefindType(PredefinedType.PT_OBJECT);
}

ExprOperator rval = GetExprFactory().CreateOperator(ek, pTypeErr, pOperand1, pOperand2);
Expand Down Expand Up @@ -1976,7 +1954,7 @@ internal CType chooseArrayIndexType(Expr args)
// first, select the allowable types
for (int ipt = 0; ipt < s_rgptIntOp.Length; ipt++)
{
CType type = GetReqPDT(s_rgptIntOp[ipt]);
CType type = GetPredefindType(s_rgptIntOp[ipt]);
foreach (Expr arg in args.ToEnumerable())
{
if (!canConvert(arg, type))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private void LookForCandidates()
}

// Mark object.
AggregateType typeObject = GetSymbolLoader().GetReqPredefType(PredefinedType.PT_OBJECT);
AggregateType typeObject = GetSymbolLoader().GetPredefindType(PredefinedType.PT_OBJECT);
_HiddenTypes.Add(typeObject);
}
}
Expand Down Expand Up @@ -582,7 +582,7 @@ private static Expr GenerateOptionalArgument(
// This is the specific case where we want to create a DateTime
// but the constval that stores it is a long.

AggregateType dateTimeType = symbolLoader.GetReqPredefType(PredefinedType.PT_DATETIME);
AggregateType dateTimeType = symbolLoader.GetPredefindType(PredefinedType.PT_DATETIME);
optionalArgument = exprFactory.CreateConstant(dateTimeType, ConstVal.Get(DateTime.FromBinary(cv.Int64Val)));
}
else if (pConstValType.isSimpleOrEnumOrString())
Expand Down Expand Up @@ -636,7 +636,7 @@ private static Expr GenerateOptionalArgument(
{
// Otherwise, we generate Type.Missing

AggregateSymbol agg = symbolLoader.GetOptPredefAgg(PredefinedType.PT_MISSING);
AggregateSymbol agg = symbolLoader.GetPredefAgg(PredefinedType.PT_MISSING);
Name name = NameManager.GetPredefinedName(PredefinedName.PN_CAP_VALUE);
FieldSymbol field = symbolLoader.LookupAggMember(name, agg, symbmask_t.MASK_FieldSymbol) as FieldSymbol;
FieldWithType fwt = new FieldWithType(field, agg.getThisType());
Expand Down
Loading