protected override void VisitType(VBType node) { Prefix("T:"); VisitBaseQualifier(node.ContainingNamespace); VisitBaseQualifier(node.ContainingType); if (node.IsPrimitive) { Code.Append(node.TypeCode.ToString()); return; } Code.Append(node.Name); if (inCoreType) { if (node.TypeParameters.Count > 0) { Code.Append("`" + node.TypeParameters.Count); } } else { // If we're in a parameter, include its concrete type arguments if (node.TypeArguments.Count > 0) { Code.Append("{"); VisitCommaList(node.TypeArguments); Code.Append("}"); } } }
///<summary>Gets the total number of type parameters in this type's outer generic types.</summary> static int PreTypeParamCount(VBType type) { if (type.ContainingType == null) { return(0); } return(PreTypeParamCount(type.ContainingType) + type.ContainingType.TypeParameters.Count); }
public VBRequestDocumentModel( string documentNo, DateTimeOffset date, DateTimeOffset realizationEstimationDate, int suppliantUnitId, string suppliantUnitCode, string suppliantUnitName, int suppliantDivisionId, string suppliantDivisionCode, string suppliantDivisionName, int currencyId, string currencyCode, string currencySymbol, string currencyDescription, double currencyRate, string purpose, decimal amount, bool isPosted, bool isCompleted, VBType type, bool isInklaring, string noBl, string noPo, string typePurchasing ) { DocumentNo = documentNo; Date = date; RealizationEstimationDate = realizationEstimationDate; CurrencyId = currencyId; CurrencyCode = currencyCode; CurrencySymbol = currencySymbol; CurrencyRate = currencyRate; CurrencyDescription = currencyDescription; Purpose = purpose; Amount = amount; IsPosted = isPosted; ApprovalStatus = ApprovalStatus.Draft; IsCompleted = isCompleted; Type = type; SuppliantUnitId = suppliantUnitId; SuppliantUnitCode = suppliantUnitCode; SuppliantUnitName = suppliantUnitName; SuppliantDivisionId = suppliantDivisionId; SuppliantDivisionCode = suppliantDivisionCode; SuppliantDivisionName = suppliantDivisionName; IsInklaring = isInklaring; NoBL = noBl; NoPO = noPo; TypePurchasing = typePurchasing; }
protected override void VisitTypeParameter(VBType node) { // Method type parameters get two backticks if (node.ContainingType == null) { Code.Append("``" + node.TypeParameterPosition); } else { // Type type parameter indices include parameters from the type's outer types. Code.Append("`" + (PreTypeParamCount(node.ContainingType) + node.TypeParameterPosition).ToString()); } }
public void Should_Success_Instantiate() { string RqstNo = "RqstNo"; //string VBCategory = "VBCategory"; VBType VBCategory = VBType.WithPO; DateTimeOffset RqstDate = DateTimeOffset.Now; Unit uvm = new Unit(); string Appliciant = "Appliciant"; string RealNo = "RealNo"; DateTimeOffset RealDate = DateTimeOffset.Now; DateTimeOffset?VerDate = DateTimeOffset.Now; string DiffStatus = "DiffStatus"; string Status = "Status"; decimal DiffAmount = 100; DateTimeOffset?ClearanceDate = DateTimeOffset.Now; bool IsPosted = true; ClearaceVBViewModel cvvm = new ClearaceVBViewModel(); cvvm.RqstNo = RqstNo; cvvm.VBCategory = VBCategory; cvvm.RqstDate = RqstDate; cvvm.Unit = uvm; cvvm.Appliciant = Appliciant; cvvm.RealNo = RealNo; cvvm.RealDate = RealDate; cvvm.VerDate = VerDate; cvvm.DiffStatus = DiffStatus; cvvm.Status = Status; cvvm.Unit = uvm; cvvm.DiffAmount = DiffAmount; cvvm.ClearanceDate = ClearanceDate; cvvm.IsPosted = IsPosted; Assert.Equal(RqstNo, cvvm.RqstNo); Assert.Equal(VBCategory, cvvm.VBCategory); Assert.Equal(RqstDate, cvvm.RqstDate); Assert.Equal(uvm, cvvm.Unit); Assert.Equal(Appliciant, cvvm.Appliciant); Assert.Equal(RealNo, cvvm.RealNo); Assert.Equal(RealDate, cvvm.RealDate); Assert.Equal(VerDate, cvvm.VerDate); Assert.Equal(DiffStatus, cvvm.DiffStatus); Assert.Equal(Status, cvvm.Status); Assert.Equal(uvm, cvvm.Unit); Assert.Equal(DiffAmount, cvvm.DiffAmount); Assert.Equal(ClearanceDate, cvvm.ClearanceDate); Assert.Equal(IsPosted, cvvm.IsPosted); }
protected override void VisitArray(VBType node) { VisitIfNotNull(node.ElementType); if (node.Rank == 1) { Code.Append("[]"); return; } Code.Append("["); for (int i = 0; i < node.Rank; i++) { if (i > 0) { Code.Append(","); } Code.Append("0:"); // I think VBType can only be an SZArray } Code.Append("]"); }
public VBRealizationDocumentExpeditionModel( int vbRealizationId, int vbId, string vbNo, string vbRealizationNo, DateTimeOffset vbRealizationDate, string vbRequestName, int unitId, string unitName, int divisionId, string divisionName, decimal vbAmount, decimal vbRealizationAmount, string currencyCode, double currencyRate, string purpose, VBType vbType ) { VBRealizationId = vbRealizationId; VBId = vbId; VBNo = vbNo; VBRealizationNo = vbRealizationNo; VBRealizationDate = vbRealizationDate; VBRequestName = vbRequestName; UnitId = unitId; UnitName = unitName; DivisionId = divisionId; DivisionName = divisionName; VBAmount = vbAmount; VBRealizationAmount = vbRealizationAmount; CurrencyCode = currencyCode; CurrencyRate = currencyRate; VBType = vbType; Purpose = purpose; Position = VBRealizationPosition.PurchasingToVerification; }
protected override void VisitAnonymousType(VBType node) { Code.Append("vb#AnonymousType"); }
///<summary>Gets the total number of type parameters in this type's outer generic types.</summary> static int PreTypeParamCount(VBType type) { if (type.ContainingType == null) return 0; return PreTypeParamCount(type.ContainingType) + type.ContainingType.TypeParameters.Count; }
// New Ctor With Index public VBRequestDocumentModel(string documentNo, DateTimeOffset date, DateTimeOffset realizationEstimationDate, int suppliantUnitId, string suppliantUnitCode, string suppliantUnitName, int suppliantDivisionId, string suppliantDivisionCode, string suppliantDivisionName, int currencyId, string currencyCode, string currencySymbol, string currencyDescription, double currencyRate, string purpose, decimal amount, bool isPosted, bool isCompleted, VBType type, int index, bool isInklaring, string noBl, string noPo, string typePurchasing) : this(documentNo, date, realizationEstimationDate, suppliantUnitId, suppliantUnitCode, suppliantUnitName, suppliantDivisionId, suppliantDivisionCode, suppliantDivisionName, currencyId, currencyCode, currencySymbol, currencyDescription, currencyRate, purpose, amount, isPosted, isCompleted, type, isInklaring, noBl, noPo, typePurchasing) { Index = index; }
protected override void VisitType(VBType node) { Prefix("T:"); VisitBaseQualifier(node.ContainingNamespace); VisitBaseQualifier(node.ContainingType); if (node.IsPrimitive) { Code.Append(node.TypeCode.ToString()); return; } Code.Append(node.Name); if (inCoreType) { if (node.TypeParameters.Count > 0) Code.Append("`" + node.TypeParameters.Count); } else { // If we're in a parameter, include its concrete type arguments if (node.TypeArguments.Count > 0) { Code.Append("{"); VisitCommaList(node.TypeArguments); Code.Append("}"); } } }
protected override void VisitTypeParameter(VBType node) { // Method type parameters get two backticks if (node.ContainingType == null) Code.Append("``" + node.TypeParameterPosition); else // Type type parameter indices include parameters from the type's outer types. Code.Append("`" + (PreTypeParamCount(node.ContainingType) + node.TypeParameterPosition).ToString()); }
protected override void VisitPointer(VBType node) { VisitIfNotNull(node.ElementType); Code.Append("*"); }
protected override void VisitStructure(VBType node) { base.VisitStructure(node); }
protected override void VisitArray(VBType node) { VisitIfNotNull(node.ElementType); if (node.Rank == 1) { Code.Append("[]"); return; } Code.Append("["); for (int i = 0; i < node.Rank; i++) { if (i > 0) Code.Append(","); Code.Append("0:"); // I think VBType can only be an SZArray } Code.Append("]"); }
private static string ToIndexId(Symbol symbol, ISourceFile file) { VBParameter vBParameter = symbol as VBParameter; if (vBParameter != null) { return(null); } VBMember vBMember = symbol as VBMember; if (vBMember != null) { if (vBMember.IsFunctionResultLocal) { return(null); } while (vBMember.ContainingMember != null) { vBMember = vBMember.ContainingMember; } if (vBMember.IsProperty && vBMember.Name == "Value" && vBMember.ContainingType != null && vBMember.ContainingType.Name == "InternalXmlHelper") { return(null); // "vb.XmlPropertyExtensionValue"; } if (vBMember.IsProperty && vBMember.SourceFile != null && vBMember.SourceFile.IsSolutionExtension) { if (vBMember.Name == "Computer") { return("T:Microsoft.VisualBasic.Devices." + vBMember.Name); } if (vBMember.Name == "User") { return("T:Microsoft.VisualBasic.ApplicationServices." + vBMember.Name); } if (vBMember.Name == "Application") { return(null); //"My." + vBMember.Name; } if (vBMember.ReturnType != null && vBMember.ReturnType.BaseClass != null) { return("T:Microsoft.VisualBasic.ApplicationServices." + vBMember.ReturnType.BaseClass.Name); } return(null); //"My." + vBMember.Name; } else { if (vBMember.IsSynthetic || (vBMember.IsField && vBMember.SourceFile != null)) { symbol = vBMember.ReturnType; } else { VBType containingType = vBMember.ContainingType; if (containingType != null && (containingType.IsAnonymousType || containingType.IsAnonymousDelegate)) { return(null); // "vb.AnonymousType"; } } } } VBType vBType = symbol as VBType; while (vBType != null) { if (vBType.IsArray || vBType.IsPointer) { vBType = vBType.ElementType; } else { if (vBType.DefiningType == null) { break; } vBType = vBType.DefiningType; if (vBType == file.Host.RuntimeInfo.NullableType) { return(null); //"vb.Nullable"; } } } if (vBType != null) { if (vBType.IsPrimitive) { return("T:System." + vBType.TypeCode.ToString()); // "vb." + vBType.Name; } if (vBType.IsAnonymousType || vBType.IsAnonymousDelegate) { return(null); //"vb.AnonymousType"; } if (vBType == file.Binder.ResolveType("System.Runtime.CompilerServices.ExtensionAttribute", 0)) { return(null); //"vb.ExtensionMethods"; } } if (symbol is VBNamespace) { return(null); } if (symbol != null) { // CodeBuilder adds unavoidable spaces; IndexIds never have spaces. return(symbol.ToString(new IndexIdSymbolFormatter()).Replace(" ", "")); } return(null); }