This repository was archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 313
Expand file tree
/
Copy pathMutableTuple.fs
More file actions
executable file
·168 lines (116 loc) · 4.92 KB
/
MutableTuple.fs
File metadata and controls
executable file
·168 lines (116 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Microsoft.FSharp.Linq.RuntimeHelpers
#nowarn "49" // no warning for uppercase variable names
open Microsoft.FSharp.Core
// ----------------------------------------------------------------------------
// Mutable Tuples - used when translating queries that use F# tuples
// and records. We replace tuples/records with anonymous types which
// are handled correctly by LINQ to SQL/Entities and other providers.
//
// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
//
// The terminology "mutable tuple" is now incorrect in this code -
// "immutable anonymous tuple-like types" are used instead. The key thing in this
// code is that the anonymous types used conform to the shape and style
// expected by LINQ providers, and we pass the correspondence between constructor
// arguments and properties to the magic "members" argument of the Expression.New
// constructor in Linq.fs.
//
// This terminology mistake also runs all the way through Query.fs.
// ----------------------------------------------------------------------------
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1> =
val private item1 : 'T1
member x.Item1 = x.item1
new (Item1) = { item1 = Item1 }
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1, 'T2> =
val private item1 : 'T1
member x.Item1 = x.item1
val private item2 : 'T2
member x.Item2 = x.item2
new (Item1, Item2) = { item1 = Item1; item2 = Item2 }
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1, 'T2, 'T3> =
val private item1 : 'T1
member x.Item1 = x.item1
val private item2 : 'T2
member x.Item2 = x.item2
val private item3 : 'T3
member x.Item3 = x.item3
new (Item1, Item2, Item3) = { item1 = Item1; item2 = Item2; item3 = Item3 }
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1, 'T2, 'T3, 'T4> =
val private item1 : 'T1
member x.Item1 = x.item1
val private item2 : 'T2
member x.Item2 = x.item2
val private item3 : 'T3
member x.Item3 = x.item3
val private item4 : 'T4
member x.Item4 = x.item4
new (Item1, Item2, Item3, Item4) = { item1 = Item1; item2 = Item2; item3 = Item3; item4 = Item4 }
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1, 'T2, 'T3, 'T4, 'T5> =
val private item1 : 'T1
member x.Item1 = x.item1
val private item2 : 'T2
member x.Item2 = x.item2
val private item3 : 'T3
member x.Item3 = x.item3
val private item4 : 'T4
member x.Item4 = x.item4
val private item5 : 'T5
member x.Item5 = x.item5
new (Item1, Item2, Item3, Item4, Item5) = { item1 = Item1; item2 = Item2; item3 = Item3; item4 = Item4 ; item5 = Item5 }
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1, 'T2, 'T3, 'T4, 'T5, 'T6> =
val private item1 : 'T1
member x.Item1 = x.item1
val private item2 : 'T2
member x.Item2 = x.item2
val private item3 : 'T3
member x.Item3 = x.item3
val private item4 : 'T4
member x.Item4 = x.item4
val private item5 : 'T5
member x.Item5 = x.item5
val private item6 : 'T6
member x.Item6 = x.item6
new (Item1, Item2, Item3, Item4, Item5, Item6) = { item1 = Item1; item2 = Item2; item3 = Item3; item4 = Item4 ; item5 = Item5 ; item6 = Item6 }
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1, 'T2, 'T3, 'T4, 'T5, 'T6, 'T7> =
val private item1 : 'T1
member x.Item1 = x.item1
val private item2 : 'T2
member x.Item2 = x.item2
val private item3 : 'T3
member x.Item3 = x.item3
val private item4 : 'T4
member x.Item4 = x.item4
val private item5 : 'T5
member x.Item5 = x.item5
val private item6 : 'T6
member x.Item6 = x.item6
val private item7 : 'T7
member x.Item7 = x.item7
new (Item1, Item2, Item3, Item4, Item5, Item6, Item7) = { item1 = Item1; item2 = Item2; item3 = Item3; item4 = Item4 ; item5 = Item5 ; item6 = Item6 ; item7 = Item7 }
/// This type shouldn't be used directly from user code.
type AnonymousObject<'T1, 'T2, 'T3, 'T4, 'T5, 'T6, 'T7, 'T8> =
val private item1 : 'T1
member x.Item1 = x.item1
val private item2 : 'T2
member x.Item2 = x.item2
val private item3 : 'T3
member x.Item3 = x.item3
val private item4 : 'T4
member x.Item4 = x.item4
val private item5 : 'T5
member x.Item5 = x.item5
val private item6 : 'T6
member x.Item6 = x.item6
val private item7 : 'T7
member x.Item7 = x.item7
val private item8 : 'T8
member x.Item8 = x.item8
new (Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8) = { item1 = Item1; item2 = Item2; item3 = Item3; item4 = Item4 ; item5 = Item5 ; item6 = Item6 ; item7 = Item7; item8 = Item8 }