static DataTypes() { var mutableReferenceGenericTypeBuilder = NITypes.Factory.DefineReferenceClass("MutableReference"); mutableReferenceGenericTypeBuilder.MakeGenericParameters("TDeref", "TLife"); mutableReferenceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); MutableReferenceGenericType = mutableReferenceGenericTypeBuilder.CreateType(); var immutableReferenceGenericTypeBuilder = NITypes.Factory.DefineReferenceClass("ImmutableReference"); immutableReferenceGenericTypeBuilder.MakeGenericParameters("TDeref", "TLife"); immutableReferenceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); ImmutableReferenceGenericType = immutableReferenceGenericTypeBuilder.CreateType(); var polymorphicReferenceGenericTypeBuilder = NITypes.Factory.DefineReferenceClass("PolymorphicReference"); polymorphicReferenceGenericTypeBuilder.MakeGenericParameters("TDeref", "TLife", "TMut"); polymorphicReferenceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); PolymorphicReferenceGenericType = polymorphicReferenceGenericTypeBuilder.CreateType(); var cloneInterfaceBuilder = NITypes.Factory.DefineReferenceInterface("Clone"); cloneInterfaceBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); CloneInterfaceType = cloneInterfaceBuilder.CreateType(); var dropInterfaceBuilder = NITypes.Factory.DefineReferenceInterface("Drop"); dropInterfaceBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); DropInterfaceType = dropInterfaceBuilder.CreateType(); var displayInterfaceBuilder = NITypes.Factory.DefineReferenceInterface("Display"); displayInterfaceBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); DisplayInterfaceType = displayInterfaceBuilder.CreateType(); var optionGenericTypeBuilder = NITypes.Factory.DefineValueClass("Option"); optionGenericTypeBuilder.MakeGenericParameters("T"); optionGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); OptionGenericType = optionGenericTypeBuilder.CreateType(); var lockingCellGenericTypeBuilder = NITypes.Factory.DefineReferenceClass("LockingCell"); lockingCellGenericTypeBuilder.MakeGenericParameters("T"); lockingCellGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); LockingCellGenericType = lockingCellGenericTypeBuilder.CreateType(); var sharedGenericTypeBuilder = NITypes.Factory.DefineReferenceClass("Shared"); sharedGenericTypeBuilder.MakeGenericParameters("T"); sharedGenericTypeBuilder.DefineImplementedInterfaceFromExisting(CloneInterfaceType); sharedGenericTypeBuilder.DefineImplementedInterfaceFromExisting(DropInterfaceType); sharedGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); SharedGenericType = sharedGenericTypeBuilder.CreateType(); var iteratorGenericTypeBuilder = NITypes.Factory.DefineReferenceInterface("Iterator"); iteratorGenericTypeBuilder.MakeGenericParameters("TItem"); iteratorGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); IteratorInterfaceGenericType = iteratorGenericTypeBuilder.CreateType(); var rangeIteratorTypeBuilder = NITypes.Factory.DefineReferenceClass("RangeIterator"); var iteratorSpecialization = IteratorInterfaceGenericType.ReplaceGenericParameters(NITypes.Int32); rangeIteratorTypeBuilder.DefineImplementedInterfaceFromExisting(iteratorSpecialization); rangeIteratorTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); RangeIteratorType = rangeIteratorTypeBuilder.CreateType(); var stringSliceTypeBuilder = NITypes.Factory.DefineValueClass("StringSlice"); stringSliceTypeBuilder.DefineImplementedInterfaceFromExisting(DisplayInterfaceType); stringSliceTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); StringSliceType = stringSliceTypeBuilder.CreateType(); var stringSplitIteratorTypeBuilder = NITypes.Factory.DefineValueClass("StringSplitIterator"); NIType sliceReferenceLifetimeParameter = AddGenericLifetimeTypeParameter(stringSplitIteratorTypeBuilder, "TLife"); iteratorSpecialization = IteratorInterfaceGenericType.ReplaceGenericParameters( StringSliceType.CreateImmutableReference(sliceReferenceLifetimeParameter)); stringSplitIteratorTypeBuilder.DefineImplementedInterfaceFromExisting(iteratorSpecialization); stringSplitIteratorTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); StringSplitIteratorGenericType = stringSplitIteratorTypeBuilder.CreateType(); var vectorGenericTypeBuilder = NITypes.Factory.DefineReferenceClass("Vector"); vectorGenericTypeBuilder.MakeGenericParameters("T"); vectorGenericTypeBuilder.DefineImplementedInterfaceFromExisting(DropInterfaceType); vectorGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); VectorGenericType = vectorGenericTypeBuilder.CreateType(); var sliceGenericTypeBuilder = NITypes.Factory.DefineReferenceClass("Slice"); sliceGenericTypeBuilder.MakeGenericParameters("TElem"); sliceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); SliceGenericType = sliceGenericTypeBuilder.CreateType(); var sliceIteratorGenericTypeBuilder = NITypes.Factory.DefineValueClass("SliceIterator"); sliceIteratorGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); NIType elementType = sliceIteratorGenericTypeBuilder.MakeGenericParameters("TElem").First().CreateType(); NIType lifetimeType = AddGenericLifetimeTypeParameter(sliceIteratorGenericTypeBuilder, "TLife"); iteratorSpecialization = IteratorInterfaceGenericType.ReplaceGenericParameters(elementType.CreateImmutableReference(lifetimeType)); sliceIteratorGenericTypeBuilder.DefineImplementedInterfaceFromExisting(iteratorSpecialization); sliceIteratorGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); SliceIteratorGenericType = sliceIteratorGenericTypeBuilder.CreateType(); var sliceMutableIteratorGenericTypeBuilder = NITypes.Factory.DefineValueClass("SliceMutableIterator"); sliceMutableIteratorGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); elementType = sliceMutableIteratorGenericTypeBuilder.MakeGenericParameters("TElem").First().CreateType(); lifetimeType = AddGenericLifetimeTypeParameter(sliceMutableIteratorGenericTypeBuilder, "TLife"); iteratorSpecialization = IteratorInterfaceGenericType.ReplaceGenericParameters(elementType.CreateMutableReference(lifetimeType)); sliceMutableIteratorGenericTypeBuilder.DefineImplementedInterfaceFromExisting(iteratorSpecialization); sliceMutableIteratorGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); SliceMutableIteratorGenericType = sliceMutableIteratorGenericTypeBuilder.CreateType(); var fileHandleTypeBuilder = NITypes.Factory.DefineValueClass("FileHandle"); fileHandleTypeBuilder.DefineImplementedInterfaceFromExisting(DropInterfaceType); fileHandleTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); FileHandleType = fileHandleTypeBuilder.CreateType(); var fakeDropTypeBuilder = NITypes.Factory.DefineValueClass("FakeDrop"); fakeDropTypeBuilder.DefineImplementedInterfaceFromExisting(DropInterfaceType); FakeDropType = fakeDropTypeBuilder.CreateType(); var promiseInterfaceGenericTypeBuilder = NITypes.Factory.DefineReferenceInterface("Promise"); promiseInterfaceGenericTypeBuilder.MakeGenericParameters("TValue"); promiseInterfaceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); PromiseInterfaceGenericType = promiseInterfaceGenericTypeBuilder.CreateType(); var wakerTypeBuilder = NITypes.Factory.DefineValueClass("Waker"); WakerType = wakerTypeBuilder.CreateType(); var yieldPromiseGenericTypeBuilder = NITypes.Factory.DefineValueClass("YieldPromise"); var yieldParameters = yieldPromiseGenericTypeBuilder.MakeGenericParameters("T"); var promiseSpecialization = PromiseInterfaceGenericType.ReplaceGenericParameters(yieldParameters.First().CreateType()); yieldPromiseGenericTypeBuilder.DefineImplementedInterfaceFromExisting(promiseSpecialization); yieldPromiseGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); YieldPromiseGenericType = yieldPromiseGenericTypeBuilder.CreateType(); var methodCallPromiseGenericTypeBuilder = NITypes.Factory.DefineValueClass("MethodCallPromise"); var methodCallPromiseParameters = methodCallPromiseGenericTypeBuilder.MakeGenericParameters("T"); promiseSpecialization = PromiseInterfaceGenericType.ReplaceGenericParameters(methodCallPromiseParameters.First().CreateType()); methodCallPromiseGenericTypeBuilder.DefineImplementedInterfaceFromExisting(promiseSpecialization); methodCallPromiseGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); MethodCallPromiseGenericType = methodCallPromiseGenericTypeBuilder.CreateType(); var notifierReaderGenericTypeBuilder = NITypes.Factory.DefineValueClass("NotifierReader"); notifierReaderGenericTypeBuilder.MakeGenericParameters("T"); notifierReaderGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); NotifierReaderGenericType = notifierReaderGenericTypeBuilder.CreateType(); var notifierWriterGenericTypeBuilder = NITypes.Factory.DefineValueClass("NotifierWriter"); notifierWriterGenericTypeBuilder.MakeGenericParameters("T"); notifierWriterGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); NotifierWriterGenericType = notifierWriterGenericTypeBuilder.CreateType(); var notifierReaderPromiseGenericTypeBuilder = NITypes.Factory.DefineValueClass("NotifierReaderPromise"); var notifierParameters = notifierReaderPromiseGenericTypeBuilder.MakeGenericParameters("T"); promiseSpecialization = PromiseInterfaceGenericType.ReplaceGenericParameters(notifierParameters.First().CreateType().CreateOption()); notifierReaderPromiseGenericTypeBuilder.DefineImplementedInterfaceFromExisting(promiseSpecialization); notifierReaderPromiseGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); NotifierReaderPromiseGenericType = notifierReaderPromiseGenericTypeBuilder.CreateType(); var panicResultGenericTypeBuilder = NITypes.Factory.DefineValueClass("PanicResult"); var panicResultParameters = panicResultGenericTypeBuilder.MakeGenericParameters("T"); panicResultGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); PanicResultGenericType = panicResultGenericTypeBuilder.CreateType(); }
static DataTypes() { var mutableReferenceGenericTypeBuilder = PFTypes.Factory.DefineReferenceClass("MutableReference"); mutableReferenceGenericTypeBuilder.MakeGenericParameters("TDeref", "TLife"); mutableReferenceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); MutableReferenceGenericType = mutableReferenceGenericTypeBuilder.CreateType(); var immutableReferenceGenericTypeBuilder = PFTypes.Factory.DefineReferenceClass("ImmutableReference"); immutableReferenceGenericTypeBuilder.MakeGenericParameters("TDeref", "TLife"); immutableReferenceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); ImmutableReferenceGenericType = immutableReferenceGenericTypeBuilder.CreateType(); var polymorphicReferenceGenericTypeBuilder = PFTypes.Factory.DefineReferenceClass("PolymorphicReference"); polymorphicReferenceGenericTypeBuilder.MakeGenericParameters("TDeref", "TLife", "TMut"); polymorphicReferenceGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); PolymorphicReferenceGenericType = polymorphicReferenceGenericTypeBuilder.CreateType(); var optionGenericTypeBuilder = PFTypes.Factory.DefineValueClass("Option"); optionGenericTypeBuilder.MakeGenericParameters("T"); optionGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); OptionGenericType = optionGenericTypeBuilder.CreateType(); var lockingCellGenericTypeBuilder = PFTypes.Factory.DefineReferenceClass("LockingCell"); lockingCellGenericTypeBuilder.MakeGenericParameters("T"); lockingCellGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); LockingCellGenericType = lockingCellGenericTypeBuilder.CreateType(); var nonLockingCellGenericTypeBuilder = PFTypes.Factory.DefineReferenceClass("NonLockingCell"); nonLockingCellGenericTypeBuilder.MakeGenericParameters("T"); nonLockingCellGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); NonLockingCellGenericType = nonLockingCellGenericTypeBuilder.CreateType(); var iteratorGenericTypeBuilder = PFTypes.Factory.DefineReferenceInterface("Iterator"); iteratorGenericTypeBuilder.MakeGenericParameters("TItem"); iteratorGenericTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); IteratorInterfaceGenericType = iteratorGenericTypeBuilder.CreateType(); var rangeIteratorTypeBuilder = PFTypes.Factory.DefineReferenceClass("RangeIterator"); var iteratorSpecialization = IteratorInterfaceGenericType.ReplaceGenericParameters(PFTypes.Int32); rangeIteratorTypeBuilder.DefineImplementedInterfaceFromExisting(iteratorSpecialization); rangeIteratorTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); RangeIteratorType = rangeIteratorTypeBuilder.CreateType(); var stringSliceTypeBuilder = PFTypes.Factory.DefineValueClass("StringSlice"); stringSliceTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); StringSliceType = stringSliceTypeBuilder.CreateType(); var vectorGenericTypeBuilder = PFTypes.Factory.DefineReferenceClass("Vector"); vectorGenericTypeBuilder.MakeGenericParameters("T"); vectorGenericTypeBuilder.AddTypeKeywordProviderAttribute("RustyWiresReferece"); VectorGenericType = vectorGenericTypeBuilder.CreateType(); var fileHandleTypeBuilder = PFTypes.Factory.DefineValueClass("FileHandle"); fileHandleTypeBuilder.AddTypeKeywordProviderAttribute(RebarTypeKeyword); FileHandleType = fileHandleTypeBuilder.CreateType(); }